السلام عليكم و رحمة الله تعالى و بركاته
قمت بعمل اول سكريبت لي بالبايثون وهو يقوم بتحويل درجة الحرارة , اريد منكم تقيمي و اعطائي نصائح و ملاحظات
و هذا هو
print("welcome to program temperature conversions ")
aa = True
while aa :
try:
print("1 - convert to Kelvin (°K)")
print("2 - convert to Fahrenheit (°F)")
print("3 - convert to Rankine ")
print("4 - exit")
b = int(input("please enter number : ")
if (b == 1):
print(" convert to Kelvin ")
c = int(input("please enter temperature in Celsius (°C) : ")
k = c + 273.15
print(" temperature in Kelvin : ",k)
elif (b == 2):
print(" convert to Fahrenheit ")
c = int(input("please enter temperature in Celsius (°C) : ")
f = (1.8*c)+32
print(" temperature in Kelvin : ",f)
elif (b == 3):
print(" convert to Rankine ")
c = int(input("please enter temperature in Celsius (°C) : ")
r = 1.8*(c+273.15)
print(" temperature in Kelvin : ",r)
else (b == 4):
print("exit")
aa = False
except ValueError :
print("invalid try again ")