+ 3
When I am doing exercises for practice and they mention a constraint, should I assume it will be true or check for it?
If in the letter of an exercise they say for example "constraint:1<=x<100 where x is input " should I validate if this is true in the code or just asume it is true and the input they'll give me is between that range in this case? I am not sure so if you could help me I would be really grateful 😊
3 Antworten
+ 1
For example in the first exercise I have to make a ceil and floor functions, it says the input is a "real" number, output print ceil and floor of the number, and constraint 1<=x<=100.
+ 1
it doesn't specify if I should make something to prevent invalid inputs
+ 1
Would need more context to opine. I would say that if a user should not do something and the program let's them do it...it's a bug.