Question: print ( Price as float:, price ) except: print ( That ' s not a price! ) Using a string method from unit
printPrice as float:", price except: printThats not a price!"
Using a string method from unit complete the program so that it can detect if a price string can be converted to a floating point number and convert it The completed program should consider the following inputs correct:
will print Price as float:
$ will print Price as float:
$ will print Price as float:
The completed program should flag the following inputs as incorrect.
spam will print That's not a price!
will print That's not a price!
price $ will print That's not a price!
Enter one or more statement that can go into the try block to complete it:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
