This assertions is not clear... I need help please | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок

This assertions is not clear... I need help please

print(1) assert 2 + 2 == 4 print(2) assert 1 + 1 == 3 print(3)

22nd Jan 2019, 1:59 PM
Olusuyi - avatar
2 ответов
+ 3
1. Output of the 5-question quiz you posted is: 1 2 Because 1+1 ==3 is false and trigger AssertError Therefore 3 will not be printed You can put the code in code playground and run to test yourself. 2. Assert is used in debugging program when there is no syntax error but the variable must fit certain condition for the program to run properly 3. Here is a demo for assertion in Python : 4. JavaScript has assertion too, a demo: In JS, program continue to run after assertion error. In Python, program terminate once assertion error is raised.
22nd Jan 2019, 2:03 PM
Gordon - avatar
thank you
22nd Jan 2019, 2:04 PM
Olusuyi - avatar