-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempconverter.py
More file actions
48 lines (31 loc) · 1.24 KB
/
tempconverter.py
File metadata and controls
48 lines (31 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! usr/bin/python3
"""
This program receives temperature input in Celcius or Frehrenheit from the user
and converts it is to Frehrenheit or Celcius
"""
def Celcius2Frehrenheit():
Cel =int(input("Please insert the Celcius value >>"))
Result = ((9/5)*Cel) +32
print (" ")
print ("**********************************************************")
print ("%d Degree Celcius = %d Degree Frehrenheit "%(Cel,Result))
print ("**********************************************************")
print (" ")
def Frehrenheit2Celcius():
Fre =int(input("Please insert the Frehrenheit value >>"))
Result = ((5/9)*(Fre-32))
print (" ")
print ("**********************************************************")
print ("%d Degree Frehrenheit = %d Degree Celcius "%(Fre,Result))
print ("**********************************************************")
print (" ")
print("This program can only convert Celcius to Frehrenheit or vice versa")
print(" ")
print("For Celcius-> Frehrenheit Conversion: Press A ; For Frehreneit -> Celcius : Press B")
Datainput= input(">> ").upper()
if Datainput== "A":
Celcius2Frehrenheit()
elif Datainput == "B":
Frehrenheit2Celcius()
else:
print("You inserted a wrong input")