Python Tutorial @ Home

# Python If Condition Programs | Set 2

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

Sol:

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

Enter name Sumit
Enter any no 19
You can vote
>>>
Enter name amit
Enter any no 12
You cannot vote
>>>

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

### Sol:

```n=int(input("Enter any no "))
if(n%7==0):
print("Number is multiple of 7")
else:
print("Number is not multiple of 7")```

## Output:

Enter any no 25
Number is not multiple of 7
Enter any no 35
Number is multiple of 7
>>>

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

Sol:

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

## Output:

Enter any no 26
Number is not multiple of 7 or 11
>>>
Enter any no 77
Number is multiple of 7 or 11
>>>
Enter any no 35
Number is multiple of 7 or 11
>>>
Enter any no 77
Number is multiple of 7 or 11
>>>

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

### Sol:

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

## Output:

Enter any no 35
Number is not multiple of 7 andor 11
>>>
Enter any no 77
Number is multiple of 7 and 11
>>>
Enter any no 55
Number is not multiple of 7 and 11
>>>

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

### Sol:

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

## Output:

Enter any no 25
Number is multiple of 5
>>>
Enter any no 6
Number is not multiple 5
>>>

### Previous : if condition programs Set 1 Next : if condition programs Set 3

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