Set 1 Set 2 Set 3 Set 4 Set 5 Set 6 Set 7 Set 8 Set 9
Question: 6
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")
Output:
Enter name Sumit
Enter any no 19
You can vote
>>>
Enter name amit
Enter any no 12
You cannot vote
>>>
Question: 7
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
>>>
Question: 8
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
>>>
Question: 9
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
>>>
Question: 10
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
>>>