P05 - Prime Numbers From 1 To 20
P05 - Prime Numbers From 1 To 20
Procedure:
Step 6: Within the nested i loop check num%i=0. If it is true then break the loop.
Step 8: After completing nested loop the else statement print the prime number.
Result: Python script that prints prime numbers less than 20 is done successfully.
Program:
# Note: The else block will NOT be executed if the loop is stopped
# by a break statement.