CBSE Class 11 Python @ Home

CBSE Class XI: Python If Condition

Class 11: if condition 2

Question:1
Write a Python script to take input for a number, check and print whether the number is +ve or not?
Sol:

a=int(input("Enter any no "))
if(a>0):
    print("Number is +ve")
else:
    print("Number is not +ve")

Question:2
Write a Python script to take input for a number, check and print whether the number is -ve or not?
Sol:

a=int(input("Enter any no "))
if(a<0):
    print("Number is -ve")
else:
    print("Number is not -ve")

Question:3
Write a Python script to take input for a number, check and print whether the number is zero or not?
Sol:

a=int(input("Enter any no "))
if(a%2==0):
    print("Number is even")
else:
    print("Number is not even")