I am trying to find out how to make it so the user [only enters numbers <0] and [no letters] allowed. Can someone show me how I would set this up. I have tried to set up try/catch blocks but I keep getting errors.
edgeone = input("Enter the first edge of the triangle: ")
I think you want numbers only > 0, or do you want less than zero? Anyway to do this you can using try/except, inside a while loop.
For Python 3, which I think you are using?
goodnumber = False
while not goodnumber:try:edgeone = int(input('Enter the first edge of the triangle:'))if edgeone > 0:print('thats a good number, thanks')goodnumber = Trueelse:print('thats not a number greater than 0, try again please')except ValueError:print('Thats not a number, try again please')
hope this helps.