0
Can anyone help me with the quiz 1 of assertions part?
The solution of the problem is 1 though I think it should be 0. There might be some lack of understanding on my part. Please help me understand and corrrect myself.
3 odpowiedzi
+ 3
shagun yadav
Put your question here to help u
+ 1
🤔 how we will know for what are you talking about. Please give more info about your question
0
This is how the question starts
What is the last number printed?
print(0)
assert "h" != "w"
print(1)
assert False
...
Firstly 0 is printed. Then it asserts that "h" is NOT equal to "w". This is of course True, so the program continues. Then it prints(1).
When it asserts False, this is obviously False, so the error is called and the program (as we see it) ends. This means 1 is the last number printed.