here what happens guys, what is the mean f assert | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

here what happens guys, what is the mean f assert

Assert sum_list([1,2,3])==6

25th Jun 2017, 3:32 PM
Karthick Raj
Karthick Raj - avatar
2 Answers
+ 2
1+2+3=6 do the sum of numbers
25th Jun 2017, 3:35 PM
Elie Douaihy
Elie Douaihy - avatar
+ 2
It basically means "Make sure that the sum of these numbers is 6. If not, stop the program here.". It's a way to prevent crashes after this line. Instead of crashing, the program will stop at the assert.
25th Jun 2017, 10:09 PM
Zeke Williams
Zeke Williams - avatar