Page 508 - ComputerScience_Class_11
P. 508
Output
Enter the name of a book: Data Science
Book Data Science found!
Program 9: Write a program to check if a number is a Palindrome number or not. When a number is equal to its
reverse, then it is called Palindrome number.
Example: 2002, 121
Program 9.py
File Edit Format Run Options Window Help
a=int(input('Enter any number: '))
c=a
r=0
while a>0:
d=a%10
r=r*10+d
a=a//10
if c==r:
print(c,'is a Palindrome number')
else:
print(c,'is not a Palindrome number')
Output
Enter any number: 9009
9009 is a Palindrome number
Program 10: Write a program that simulates a vending machine. The program should:
• Display available items (Coke, Chips, Candy) and their prices.
• Allow the user to choose an item and enter money.
• Handle invalid item selection and insufficient funds.
• Provide change after a successful purchase.
• Exit the program when the user enters 'quit'.
506 Touchpad Computer Science (Ver. 3.0)-XI

