logo

Crowdly

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

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

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. 

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на lms.monashcollege.edu.au?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!