Sinisterly
Interior angle sum generator - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Python (https://sinister.li/Forum-Python)
+--- Thread: Interior angle sum generator (/Thread-Interior-angle-sum-generator)



Interior angle sum generator - Adorapuff - 11-07-2013

Coded this in 40 minutes during lunch as extra credit for math. Thats why its so commented. The bitch never "got around to it," so I'm releasing this to display the implementation of formulas in python. The formula used is 180(n-2) where n is the number of sides.
Code:
import sys #creates a main menu def menu(): #writes a welcome message print "Welcome to my interior angle sum generator!" raw_input('Press any key to continue...') #Asks for an input to make a selection x = raw_input('Enter 1 for a single value \nEnter 2 for a list of values: ') #if the input is equal to 1 it will call the first option if int(x) == 1: individual() #if the input is 2 it will call the second option elif int(x) == 2: array() #If a number other than 1 or 2 is entered it will give an error else: print "Please enter a valid number!" def menu2(): x = raw_input('---------------------------\nEnter 1 for a single value \nEnter 2 for a list of values\nEnter 3 to exit: ') #if the input is equal to 1 it will call the first option if int(x) == 1: individual() #if the input is 2 it will call the second option elif int(x) == 2: array() #If a number other than 1 or 2 is entered it will give an error elif int(x) == 3: sys.exit('Thank you for using Int Sum Generator by Ryan Shtirmer!') else: print "Please enter a valid number!" #creates a function for one polygon with the given number of sides def individual(): #asks for an input of the number of sides n = raw_input('Number of sides: ') #Checks if the input is less than 3 if int(n) < 3: print "Please enter a number above 3!" individual() #Runs and displays the formula if n >= 3: x = int(n)-2 print x * 180 raw_input('Press any key to continue...') else: individual() menu2() #Creates a function to make a list of angles sums between 3 and the inputted number def array(): #number of sides is 3 n=3 #Asks for the highest number of sides z = raw_input('Highest Number of sides: ') #Checks if the number is less than 4 or greater than 500 if int(z) < 4: print "Please enter a number greater than 3!" array() if int(z) > 500: print "Please enter a number less than 500!" array() #Runs the formula on all numbers between 3 and the given number if int(z) >= 4 and int(z) <=500: while n<int(z): x=n-2 print str(n) + ":" + str(x * 180) n+=1 raw_input('Press any key to continue...') menu2() else: array() menu()



RE: Interior angle sum generator - Sir - 11-07-2013

Sounds like that bitch is a hater bruh. Should poison her ovaries or something.

Looks useful. Thanks. Smile


RE: Interior angle sum generator - Adorapuff - 11-07-2013

(11-07-2013, 01:58 AM)Sir Wrote: Sounds like that bitch is a hater bruh. Should poison her ovaries or something.

Looks useful. Thanks. Smile

You don't even know. I need 1 fuckin percent to get an A. And theres no grades left in the quarter.


RE: Interior angle sum generator - Sir - 11-07-2013

(11-07-2013, 01:59 AM)Putin Wrote: You don't even know. I need 1 fuckin percent to get an A. And theres no grades left in the quarter.

I'd speak up tbh. Idk what exactly can be done about it, but I'm sure something can?


Interior angle sum generator - Adorapuff - 11-07-2013

(11-07-2013, 02:00 AM)Sir Wrote: I'd speak up tbh. Idk what exactly can be done about it, but I'm sure something can?

In my school absolutly nothing. She agreed to give the credit because she didn't think i could do it.