Check buzz number in Python
if else - Question 10
In this question, we will see how to check if a number is a buzz number or not in Python programming using the if else statement. To know more about if else statement click on the if else statement lesson.
Q10) Write a program in Python to input a number and check if it is a buzz number or not. A number is a buzz number if it is divisible by 7 or if its last digit is 7. Make use of logical operator (or) to solve this question.
Program
n=int(input('Enter a number '))
if n%7==0 or n%10==7:
print('Buzz number')
else:
print('Not a buzz number')
Output
Enter a number 21 Buzz number