calculator - Python - If more inputs return error (How to do) -
Initial programmer, I am creating a function that class routs counts, here's my job:
The input is a tube that i really want to be like but problem here Comes, I also want that if a user inserts Here's what I thought Part Use the built in ("sqrt", number)
def calculator: if input [0 ] == "Sqrt": If the input [1] & lt; Error for negative input of number #: "No square root for negative number" and: ans = (input [1]) ** (0.5) return AN
("sqrt", number 1, number 2) more than an input, then this error says "code only" Input "
if input [1] == anything at all: return" please only one click here Put "
anything me what function ?? Actually I tried
if input [1]! Of course, I have a big mistake ...
len () function to ensure that the length is not high:
DF calculator (input): if the lane ( Input) & gt; 2: print "please only break one input": # # rest of the code in your input # [0] == "sqrt": If the input [1] & lt; 0: # Error for Negative Input for Number Return "No Category No Negative Number for Root" and: ans = (Input [1]) ** (0.5) Return AN / <
Comments
Post a Comment