logo

Crowdly

Next, write some code (adding onto the previous part) that validates the input ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Next, write some code (adding onto the previous part) that validates the input value provided by the user to the following requirements:

  • The user input should should be non-negative (positive), less than 500 and has no more than 3 decimal places.
  • If the input does not meet the requirements above, you should  print the message 'You must provide a valid input' and ask the user for a new input
Note: to check if a given value has no more than n decimal places, you can check if the given value is equal to the same value rounded to n decimal places. 

More questions like this

Want instant access to all verified answers on lms.monashcollege.edu.au?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!