Cs Practical June 9 25
Cs Practical June 9 25
num=int(input("Enter a number"))
rem=0
rev=0
num1=num
while num>0:
rem=num%10
rev=rev*10+rem
num=num//10
if num1==rev:
print("Palindrome")
else:
print("Not palindrome")
print(c,end="<-->")
print()
print("---------------------------------------------------")
3 Write a python program to find
1. FACTORS
2. FACTORIAL
3. PRIME OR NOT
4 Create a program to calculate electricity Charges and this rates:
1 to 100 units – 1.5Rs
101 to 200 units – 2.5Rs
201 to 300 units – 4Rs
300 to 350 units – 5Rs
Above 350 – Fixed charge 1500Rs
unit=int(input("Enter the Electricity consumed"))
name=input("Name of the Consumer")
if unit<=100:
amount=unit*1.5
elif unit<=200:
amount=100*1.5+(unit-100)*2.5
elif unit<=300:
amount=100*1.5+100*2.5+(unit-200)*4
elif unit<=350:
amount=100*1.5+100*2.5+100*4+(unit-300)*5
else:
amount=100*1.5+100*2.5+100*4+(unit-300)*5+1500
print("Dear :",name,"Your electricity Charge is :",amount)
5 Accept a number and find (1) Armstrong number (2) Digit sum
6 Accept a list of numbers and find the largest and smallest number
7 Accept a list and find the position of a number accepted from user.
8 Write a program to accept a list of number and find the frequency of each item in the List
using the dictionary.
9 Manu driven program to implement the function in List.
10 Manu driven program to implement the function in Dictionary.
11 Write a program to find the GCD of two numbers.
15
Write a program a menu driven program
1. To input State : Capital pair as the key value pair
2. Search the capital of a state accepted from user.
3. Display all key value pair
4. Exit
16