1)Write Python code that asks the user for two angles of a triangle. Then, first determine if the triangle can
exist (make sure that the third angle can be found such that the sum of the three angles is 180°, with all
angles both given and computed conforming to the definition of a triangle). If the triangle can’t exist,
print a message explaining the fact, and quit. If it can exist, then the code should proceed to step 2.
2. Discover whether the triangle has any of the following properties: right, acute, obtuse, isosceles,
equilateral. Print out this information in a formatted way, such as this (but with correct yesses/no’s):
Right: no
Acute: yes
Obtuse: no
Isosceles: yes
Equilateral: yes
3. Implement your program so that at the end, the user is asked if they want to compute
properties for another triangle; if they indicate they want to do so, perform the calculation again. This
option should be available an unlimited number of times, after each successive triangle computation.
Your menu code should accept these inputs to make a choice: "Yes", "yes", "y", "Y","No", "no", "n", or
"N". (Hint: draw a flow chart and then write pseudocode before attempting this).

You forgot your pseudocode and code. Do not forget to push CODE

Edited 3 Years Ago by happygeek: fixed formatting

please hel me set up the structure i really dont know so like this:

def main():

a = input('enter first number ')
b = input('enter second number ')
c = raw_input("")

1)Write Python code that asks the user for two angles of a triangle. Then, first determine if the triangle can
exist (make sure that the third angle can be found such that the sum of the three angles is 180°, with all
angles both given and computed conforming to the definition of a triangle). If the triangle can’t exist,
print a message explaining the fact, and quit. If it can exist, then the code should proceed to step 2.
2. Discover whether the triangle has any of the following properties: right, acute, obtuse, isosceles,
equilateral. Print out this information in a formatted way, such as this (but with correct yesses/no’s):
Right: no
Acute: yes
Obtuse: no
Isosceles: yes
Equilateral: yes
3. Implement your program so that at the end, the user is asked if they want to compute
properties for another triangle; if they indicate they want to do so, perform the calculation again. This
option should be available an unlimited number of times, after each successive triangle computation.
Your menu code should accept these inputs to make a choice: "Yes", "yes", "y", "Y","No", "no", "n", or
"N". (Hint: draw a flow chart and then write pseudocode before attempting this).

Comments
Fail.

We equal your effort, teacher actually even almost gave the pseudocode.

calculate_triangle()
while want_continue():
    calculate_triangle()

Edited 5 Years Ago by pyTony: n/a

We equal your effort, teacher actually even almost gave the pseudocode.

calculate_triangle()
while want_continue():
    calculate_triangle()

I know, but how do I use that to write the code? To calculate the angle i need to add the two angles and subtract by 180.

i tried doing this but it doesnt work:

def main():
	print('Enter Sides of the angle')
	a = input('enter first angle ')
	b = input('enter second second angle ')
	c = 180-(a+b)
	
	
	
	if (ab > c) & (ac > b) & (bc > a):		
			if(a == b) & (a == c): 
				print 'equilateral'
			elif (a == b) | (a == c) | (b == c):
				print 'isosceles'
			else:
				print 'scalene'
		else: print "Invalid"
	
	
main()

can you help me with the first part pleaseeeeee

We equal your effort, teacher actually even almost gave the pseudocode.

calculate_triangle()
while want_continue():
    calculate_triangle()

can you plese help me pytony??

Edited 5 Years Ago by Nick Evan: n/a

Help yourself by reading instructions carefully:
If the triangle can’t exist, print a message explaining the fact, and quit.

ac etc. are not defined. & is not in correct context, it is binary bitwise and.

Edited 5 Years Ago by pyTony: n/a

Well Jose,
first how would you determine this matematically?
then show us that you've written the pseudo-code.

well my PyScripter a FREE Python Scripter program creates this when i say make NEW

#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      Cap User
#
# Created:     19/10/2011
# Copyright:   (c) Cap User 2011
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

def main():
    pass

if __name__ == '__main__':
    main()

this is how i start any program i do

#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      user
#
# Created:     13/09/2011
# Copyright:   (c) user 2011
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python


#>> ERW #>>
from time import gmtime, strftime;

#?? ERW #??
### ERW ###
### ERW ###
### ERW ###
#?? ERW #??

def main():
    pass

#?? ERW #??
### ERW ###
### ERW ###
### ERW ###
#?? ERW #??

print("#>> ERW #>>",strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()));

print(); ### ERW ###

if __name__ == '__main__':
    main()

#?? ERW #??
### ERW ###
### ERW ###
### ERW ###
#?? ERW #??

print(); ### ERW ###

print("#<< ERW #<<",strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()));#<< ERW #<<
input("Press Enter to continue..."); #?? ERW #??

so there you should be able to start what you wish to do if you just add some things like

a = input("please enter if you wish to make a trangle? Y/N")
if a.upper() == "Y" 
    print("good")
else 
    print("bad")

sorry i was only looking at first page of this thread ....
as for second page it looks like you are making Pseudocode not Python code but have not defined you logic well

if (ab > c) & (ac > b) & (bc > a):

don't understand is ab is meant to mean a * b or a + b ... i would be more likely to test

if a <= 180 & b <= 180 & a >= 0 & b >= 0 
   c = a + b - 180 
else
   print ("bad input ... please re-enter valid angles ... have a nice day ...")

before i would test if for type of traingle

Edited 5 Years Ago by Cireyoretihw: n/a

This article has been dead for over six months. Start a new discussion instead.