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 ("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   

but problem here Comes, I also want that if a user inserts ("sqrt", number 1, number 2) more than an input, then this error says "code only" Input "

Here's what I thought

  if input [1] == anything at all: return" please only one click here Put "  

Part anything me what function ?? Actually I tried

  if input [1]! Of course, I have a big mistake ...   

Use the built in 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

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -