Python Tutorial @ Home

# Python If Condition Programs | Set 3

## Write a python script to take input for a number check and print whether the number is multiple of 5 or 11 not?

### Sol:

n=int(input("Enter any no "))
if(n%5==0 or n%11==0):
print("number is multiple of 5 or 11")
else:
print("number is not multiple of 5 or 11")

## Output:

case 1:
Enter any no 5
number is multiple of 5 or 11
>>>
case 2:
Enter any no 26
number is not multiple of 5 or 11
>>>
case 3:
Enter any no 22
number is multiple of 5 or 11
>>>

## Write a python script to take input for a number check and print whether the number is multiple of 5 and 7 not?

### Sol:

n=int(input("Enter any no "))
if(n%5==0 and n%11==0):
print("number is multiple of 5 and 11")
else:
print("number is not multiple of 5 and 11")

## Output:

case 1:
Enter any no 55
number is multiple of 5 and 11
>>>
Enter any no 22
number is not multiple of 5 and 11
>>>
case 3:
Enter any no 45
number is not multiple of 5 and 11
>>>

## write a python script to take input for two number check and print the larger number? (Method :1 )

### Sol:

a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
if(a>b):
print("Max no = ",a)
else:
print("Max no = ",b)

Enter 1st no 25
Enter 2nd no 63
Max no = 63
>>>
Enter 1st no 78
Enter 2nd no 69
Max no = 78
>>>

## write a python script to take input for two number check and print the larger number? (Method :2 )

### Sol:

a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
if(a>b):
m=a
else:
m=b
print("Max no = ",m)

Enter 1st no 52
Enter 2nd no 96
Max no = 96
>>>
Enter 1st no 256
Enter 2nd no 325
Max no = 325
>>>

## Write a python script to take input name and age of a personm check and print whether the person can vote or not?

### Sol:

name=input("Enter name ")
age=int(input("Enter age "))
if(age>=18):
print("You can vote")
else:
print("You cannot vote")

## Output:

Enter name amit
Enter age 15
You cannot vote
>>>
Enter name Sumit
Enter age 21
You can vote
>>>

### 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