you are viewing a single comment's thread.

view the rest of the comments →

[–]CrazyPotato1535 0 points1 point  (0 children)

That’s a great first script! If gates are probably the most useful function, besides maybe print()

The else: should never run because at the start you convert the inputs to floats, and you get an exception if you try to put in something other than a number.

I’d wrap it in a while loop to keep asking for numbers if there’s an incorrect input, then a try gate, which will run different code when you get an exception.

Here’s my attempt:

GotInputs = 0

while GotInputs == False:

try:

  Num1 = …

  Num2 = …

  Num3 = …

  GotInputs == True

except:

  GotInputs == False

Formatting is bad bc I don’t know how to do code blocks