Monday, 24 June 2019

if else statement


#find out whether the given no is even or odd
a=int(input("enter any value"))
if a%2==0:
    print(a," is even number")
else:
    print(a," is odd number")
"""
output
enter any value4
4  is even number
>>>
enter any value11
11  is odd number
>>>
"""
a=int(input("enter a number:"))
if a>=4 and a<=10:
    print("u typed",a,"which is betwn 1 and 10")
else:
    print("u typed",a,"which is below 4 or above 10")
"""output:
enter a number:4
u typed 4 which is betwn 1 and 10
>>>
"""


Next Topic: if..elif..else statemnet
Previous Topic: if statement Conditional Statements

No comments:

Post a Comment

Files with Exception handling

#Ask the user to take two input integer values var a,b try:     a=int(input("enter any integer value:"))     b=int(input(...