jeudi 30 août 2018

use of if else statement in python getting runtime error

n=range(101)
if n%2==0:
     print("weird")
if range(2,6):
     print("not weird")
if range(6,21):
     print("weird")
if n>20:
     print("not weird")
else :
     print("weird")

Given an integer, , perform the following conditional actions:

If is odd, print Weird If is even and in the inclusive range of 2 to 5, print Not Weird If is even and in the inclusive range of 6 to 20 , print Weird If is even and greater than 20, print Not Weird

Aucun commentaire:

Enregistrer un commentaire