+ 2
Having a problem in Python Exceptions and files.
Hey ive decided to learn python lately and I got into Exceptions and files. I got to the raising Exceptions quizz and I got no idea how to solve it everything I'm trying its says wrong Evenn tried to run it in any code editor and I got it right but seems like solo learn didn't The Questions : num = input(":") if float(num) [I have to put something here] 0: raise ValueError("Negative!") Thanks in advance Liam.
3 Answers
+ 2
I think you are supposed to place the right logic operator. In your case, you need to raise an exception if a negative number is entered, so you have to check for it. "float(num) < 0"
+ 2
Number with negative value means less than zero so here the condition to set in if statement .
0
Thanks Apollo-Roboto.
i used to do <= insted of just <
Thanks!