"PYTHON"--Projects
"PYTHON"--Projects 1.Unit Converter Project:
def unitconverter():
print("----Unit Converter----")
print("1.Km to m")
print("2.m to km")
print("3.kg to grame")
print("4.grame to Kg")
print("5.Celsius(C) to Fahrenheit(F)")
print("6.Fahrenheit(F) to Celsius(C)")
choice=int(input("Enter your Choice(1-6):"))
if(choice==1):
km=float(input("Enter Distance in Km:"))
m=km*1000
print(f"{km}km={m:.2f}m")
elif(choice==2):
m=float(input("Enter Distance in meter(m):"))
km=m/1000
print(f"{m}m={km:.1f}km")
elif(choice==3):
kg=float(input("Enter Weight in kg:"))
grame=kg*1000
print(f"{kg}kg={grame:.2f}grame")
elif(choice==4):
g=float(input("Enter Weight in grame(g):"))
kg=g/1000
print(f"{g}m={kg:.2f}kg")
elif(choice==5):
c=float(input("Enter a temperature in Celcius(C):"))
f=(c*9/5)+32
print(f"{c}C={f:.2f}F")
elif(choice==6):
f=float(input("Enter a temperature in Fahrenheit(F) :"))
c=(f-32)*5/9
print(f"{f}F={c:.2f}C")
unitconverter()
2..Calculator Project:
print("~ WELCOME to Python Calculator!")
# While True loop is Contineously step
while True:
# user sa two number langain aur usko float ma convert honga.
num1=float(input("~ Enter a First number:"))
num2=float(input("~ Enter a Second number:"))
print("~ Choice The operation:-( + , - , * , / )")
operation=input("~ Enter a operation:")
if(operation=="+"):
result= num1+num2
elif(operation=="-"):
result=num1-num2
elif(operation=="*"):
result=num1*num2
elif(operation=="/"):
if(num2==0):
result="ERROR, Division by zero not allowed."
else:
result=num1/num2
else:
result="Invalid operation"
print("~ The Result is:",result)
# user sa puchanga ka tum dubara calculator karna chata ho(yes/no)
again=input("Again Calculation? (Yes/No):").lower()
if(again!="yes"):
print("Thank you for using Calculator!")
break
3.Quizzes Games :
from termcolor import colored
'''Maths Gaming for Boost your mind memory'''
print(colored("\033(🧮🧠 Boost Your Brain with Maths kahloo aur sikho-\033[0m","yellow"))
print(" Q1: 2 + 3 = ?")
a=6
b=10
c=5
d=0
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="6"):
print("The Wrong answer❌😔")
s1="0"
print("Score is:",s1)
else:
if(you=="b" or you=="10"):
print("The Wrong answer❌😔")
s2="0"
print("Score is:",s2)
elif(you=="d" or you=="0"):
print("The Wrong answer❌😔")
s3="0"
print("Score is:",s3)
elif(you=="c" or you=="5"):
print("The Corect Answer is 5 ✅")
s4="+1"
print("Score is:",s4)
print()
print(" Q2: 10 + 15 = ?")
a=25
b=30
c=20
d=1015
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="25"):
print("The Corect Answer is 25 ✅")
s5="+1"
print("Score is:",s5)
else:
if(you=="b" or you=="30"):
print("The Wrong answer❌😔")
s6="0"
print("Score is:",s6)
elif(you=="c" or you=="20"):
print("The Wrong answer❌😔")
s7="0"
print("Score is:",s7)
elif(you=="d" or you=="1015"):
print("The Wrong answer❌😔")
s8="0"
print("Score is:",s8)
print()
print(" Q3: 105 + 75 = ?")
a=25
b=175
c=180
d=185
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="25"):
print("The Wrong answer❌😔")
s9="0"
print("Score is:",s9)
else:
if(you=="b" or you=="175"):
print("The Wrong answer❌😔")
s10="0"
print("Score is:",s10)
elif(you=="c" or you=="180"):
print("The Corect Answer is 180 ✅")
s11="+1"
print("Score is:",s11)
elif(you=="d" or you=="185"):
print("The Wrong answer❌😔")
s12="0"
print("Score is:",s12)
print()
print(" Q4: 75 - 50 = ?")
a=15
b=25
c=23
d=14
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="15"):
print("The Wrong answer❌😔")
s13="0"
print("Score is:",s13)
else:
if(you=="b" or you=="25"):
print("The Corect Answer is 25 ✅")
s14="+1"
print("Score is:",s14)
elif(you=="c" or you=="23"):
print("The Wrong answer❌😔")
s15="0"
print("Score is:",s15)
elif(you=="d" or you=="14"):
print("The Wrong answer❌😔")
s16="0"
print("Score is:",s16)
print()
print(" Q5: 100 - 25 = ?")
a=25
b=75
c=125
d=50
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="25"):
print("The Wrong answer❌😔")
s17="0"
print("Score is:",s17)
else:
if(you=="b" or you=="75"):
print("The Corect Answer is 75 ✅")
s18="+1"
print("Score is:",s18)
elif(you=="c" or you=="125"):
print("The Wrong answer❌😔")
s19="0"
print("Score is:",s19)
elif(you=="d" or you=="50"):
print("The Wrong answer❌😔")
s20="0"
print("Score is:",s20)
print()
print(" Q6: 10 x 5 = ?")
a=15
b=50
c=25
d=5
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="15"):
print("The Wrong answer❌😔")
s21="0"
print("Score is:",s21)
else:
if(you=="b" or you=="50"):
print("The Corect Answer is 50 ✅")
s22="+1"
print("Score is:",s22)
elif(you=="c" or you=="25"):
print("The Wrong answer❌😔")
s23="0"
print("Score is:",s23)
elif(you=="d" or you=="5"):
print("The Wrong answer❌😔")
s24="0"
print("Score is:",s24)
print()
print(" Q7: 12 x 10 = ?")
a=22
b=12
c=2
d=120
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="22"):
print("The Wrong answer❌😔")
s25="0"
print("Score is:",s25)
else:
if(you=="b" or you=="12"):
print("The Wrong answer❌😔")
s26="0"
print("Score is:",s26)
elif(you=="c" or you=="2"):
print("The Wrong answer❌😔")
s27="0"
print("Score is:",s27)
elif(you=="d" or you=="120"):
print("The Corect Answer is 120 ✅")
s28="+1"
print("Score is:",s28)
print()
print(" Q8: 20 / 2 = ?")
a=10
b=25
c=5
d=22
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="10"):
print("The Corect Answer is 10 ✅")
s29="+1"
print("Score is:",s29)
else:
if(you=="b" or you=="25"):
print("The Wrong answer❌😔")
s30="0"
print("Score is:",s30)
elif(you=="c" or you=="5"):
print("The Wrong answer❌😔")
s31="0"
print("Score is:",s31)
elif(you=="d" or you=="22"):
print("The Wrong answer❌😔")
s32="0"
print("Score is:",s32)
print()
print(" Q9: 100 / 25 = ?")
a=25
b=75
c=4
d=50
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="25"):
print("The Wrong answer❌😔")
s33="0"
print("Score is:",s33)
else:
if(you=="b" or you=="75"):
print("The Wrong answer❌😔")
s34="0"
print("Score is:",s24)
elif(you=="c" or you=="4"):
print("The Corect Answer is 4 ✅")
s35="+1"
print("Score is:",s35)
elif(you=="d" or you=="50"):
print("The Wrong answer❌😔")
s36="0"
print("Score is:",s36)
print()
print(" Q10: 120 / 12 = ?")
a=120
b=100
c=10
d=1000
print("(a)",a,"(b)",b,"(c)",c,"(d)",d)
you=input("Enter option alphabates/number:")
if(you=="a" or you=="120"):
print("The Wrong answer❌😔")
s37="0"
print("Score is:",s37)
else:
if(you=="b" or you=="100"):
print("The Wrong answer❌😔")
s38="0"
print("Score is:",s38)
elif(you=="c" or you=="10"):
print("The Corect Answer is 10 ✅")
s39="+1"
print("Score is:",s39)
elif(you=="d" or you=="1000"):
print("The Wrong answer❌😔")
s40="0"
print("Score is:",s40)
print()
Gameing projects Snake,water,Gun:
'''1 for Snake
-1 for water
0 for Gun'''
import random
computer= random.choice([0 ,1 ,-1])
youstr=input("Enter your choice:")
youDict={"s":1, "w":-1, "g":0}
reverseDict={1:"snake",-1:"water",0:"Gun"}
you= youDict[youstr]
print(f"You Chose:{reverseDict[you]}\ncomputer
Chose: {reverseDict[computer]}")
if(computer==you):
print("Its a Draw!")
else:
if(computer==-1 and you==1):
print("You Win🎉!")
elif(computer==-1 and you==0):
print("You Lose😢!")
elif(computer==1 and you==-1):
print("You Lose😢!")
elif(computer==1 and you==0):
print("You Win🎉!")
elif(computer==0 and you==-1):
print("You Win🎉!")
elif(computer==0 and you==1):
print("You Lose😢!")
ATM System project:
# ATM System
print("<--The ATM SYSTEM PROCESS Balance,Total Blance and Deposits,
Withdraw-->")
while True:
print("1. Check Balance")
print("2. Withdraw Money")
print("3. Deposit Money")
print("4. Check Total Balance")
print("5. Exit.")
choice=int(input("Enter your Choice: "))
#Enter a Balance
balance=5000
match choice:
case 1:
print("~Your Balance is Rs.",balance)
case 2:
withdraw=int(input("Enter a amount to Withdraw:"))
print("~Enter amount to Withdraw is Rs.",withdraw)
Tb=(balance)-(withdraw)
print("~The Total Balance is Rs.",Tb)
case 3:
cho=input("Enter Your Choice ('yes'-old balance,yes Withdraw/'NO'
-No Withdraw):")
if(cho=="yes"):
deposit=int(input("Enter a amount to deposits Rs.:"))
print("~The amount to deposit is Rs.",deposit)
Tb1=(Tb)+(deposit)
print("~The Total Balance is Rs.",Tb1)
elif(cho=="no"):
print("~The Total Balance is Rs.",balance)
case 4:
print("Chek The Total Balance For Deposits (D)")
print("Chek The Total Balance For WithDraw (WD)")
print("Chek The Total Balance For Old Balance (OB)")
Cho=str(input("Enter a Choice (D/WD/OB):"))
if(Cho=="D"):
print("The Total Balance is Rs.",Tb1)
elif(Cho=="WD"):
print("The Total Balance is Rs.",Tb)
elif(Cho=="OB"):
OB=balance
print("The Old Balance is Rs.",OB)
case 5:
print("~Thank you For ATM system Process")
break
case _:
print("Invalid choice..")
projects
Comments
Post a Comment