Python Tutorial @ Home

# Python If Condition Programs | Set 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")```

## Output:

Enter any no 25
Number is +ve
>>>
Enter any no -9
Number is not +ve
>>>

## 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")```

## Output:

Enter any no 65
Number is not -ve
>>>
Enter any no -25
Number is -ve
>>>

## Write a python script to take input for a number check and print whether the number is even or not?

Sol:

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

## Sol:

Enter any no 34
Number is even
>>>
Enter any no 7
Number is not even
>>>

## WAP to take input for a number check and print whether the number is odd or not?

Sol:

```a=int(input("Enter any no "))
if(a%2==1): #or if(a%2==1):
print("Number is odd")
else:
print("Number is not odd")```

## Output:

Enter any no 5
Number is odd
>>>
Enter any no 34
Number is not odd
>>>

## WAP 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==0):
print("Number is zero")
else:
print("Number is not zero")```

Output:

Enter any no 0
Number is zero
>>>
Enter any no 5
Number is not zero
>>>

### Set 1Set 2Set 3Set 4Set 5Set 6Set 7Set 8Set 9

#### Python Basic Programming Tutorial

Python Introduction     Getting started in Python Programming      Python propgramming fundamentals     Python Operators    Python If Condition     Python for loop    Python range construct      Python While loop    break and continue statements     Different looping techniques     Python List     Python String     Python Functions    Python Inbuilt Functions     Python Recursion     Using Python Library     Python Tuples     Python Dictionary     Python Sets     Python Strings     Python Exception Handling     Python Data File Handling

Important Pages Visitor Counter       