Question: 8 . Implement iseurofloat Read the specification for the function iseurofloat. This is a function to check if a string represents a floating point number
Implement iseurofloat
Read the specification for the function iseurofloat. This is a function to check if a string represents a floating point number in European format. This format uses a comma in place of a decimal point. This type of float is formatted integer, comma, integer, where the second integer cannot be negative. Implement this function with a tryexcept statement. You are not allowed to use conditionals statements or expressions anywhere in your code.
Look at the sample code in unit for guidance on how to do this. You need to use functions that are guaranteed to crash if they do not find what they expect. For example, you may find the function indexstr in the introcs module to be helpful. Look at the documentation in the string functions for the IntroCS API accessible from the Read page in the Using Conditional Statements module
The hardest test case to address will be the input You will not be able to crash on this input without crashing on other inputs that should return True. You will be tempted to use a conditional here eg return False if the number after the comma is negative and True otherwise But while we said you could not use conditionals, you can still use boolean expressions.
When you are done with the implementation, run the test script. If you are successful, you should pass all tests.
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
