Question: programming language in python Solicit three good values (could be integer, float or string) and operate on them when any of the cases becomes true:
Solicit three good values (could be integer, float or string) and operate on them when any of the cases becomes true: (Case 1) all integer/float --> action: add them up; (Case 2) all string --> action: concatenate them. Other than the above cases we consider it bad input and must resolicit input again. This time we are requesting one-line keyboard input (you cannot break into three soliciting lines). Input values are separated by space (not comma). The space is also called delimiter (separator) in CSC terminology. If you need a quick reference watch this video (turn computer volume off). For more info, see right hand side Note Box (casting) Good Input: 20-4.50 --> Result in 15.5 Good Input: Hello World !--> Result in HelloWorld! Bad Input: O HI-223 Bad Input:%bbty78 35.0 -129 8 a = "%bbty78" 9 print("Working? ", str(a) 10 11 print("Working? ", eval(a)) 13 print("Working? ", int(a))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
