+ 1
Whats difference b/w assertion and if ?
Assertion vs if
2 Respostas
+ 4
This is the different b/w the two : if statement will be tested if the condition(s) provided return true then the block of if statement will be executed and if condition return false then the block will not be executed and next conditions will be tested (if there's any like 'elif' or 'else') but unlike assertion will only execute next line of code iff the condition tested returns true , otherwise it will terminate the program and the rest of the code will not be executed....Thank you.
+ 3
assert is meant for testing your code for checking it does what you think it does, if is for getting the code to do different things depending on some condition