Skip to content

Commit 4142599

Browse files
Merge pull request prathimacode-hub#350 from Ashu-1309/temp_converter
Temperature Converter
2 parents 96de0fc + bba84c7 commit 4142599

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed
Loading
Loading
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Temperature Converter
2+
## Aim :- Temperature Converter
3+
4+
## Purpose :-
5+
-To convertCelsius into Farenheit.
6+
-To convert Farenheit into Celsius.
7+
8+
## WorkFlow :_
9+
10+
## Script used in Temperature converter
11+
-In this program , we can convert Celsius into Fahrenheit and vise vesra.
12+
-in this program , I define four functions.
13+
14+
#1 Cel()
15+
-This function is used to convert Fahrenheit into Celsius.
16+
17+
#2 Far()
18+
-This function is used to convert Fahrenheit into Celsius.
19+
20+
#3 main()
21+
-This function is the main function for the execution of program.
22+
23+
#4 condition
24+
-This function is used to run the re-execute program.
25+
26+
## Compilation steps:-
27+
-In this program I define four function Cel(),Far(),main(),condition().
28+
Program will can the main function first then it takes input from user that whether
29+
they want to convert Celsius into Fahrenheit or vice versa.
30+
31+
-On the basis of User's selection it convert Celsius into Fahrenheit or vice vers.
32+
33+
-Then either Cel() or Far() function will be called to perform the calculation and
34+
gave the value .
35+
36+
-After performing the calculation, I gave the option whether user want to continue or exit.
37+
38+
-If want to co continue enter 1 or else to Exit.
39+
40+
41+
## Setup instructions
42+
-User needs any python id and compiler to execute the program.
43+
44+
45+
## Display images/gifs/videos of output/result of your script so that users can visualize it
46+
BasicPythonScripts/Temperature Conveter/Images/Program Stimulation.png
47+
BasicPythonScripts/Temperature Conveter/Images/Temp.png
48+
49+
50+
## Author(s)
51+
Ashutosh Kumar Saw
52+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
def Cel():
2+
celsius = float(input("Enter the temperature in Celsius ")) # It will take user input
3+
fahrenheit :float = (celsius * 9 / 5) + 32 # calculation part
4+
print("Value in Fahrenheit ", fahrenheit)
5+
6+
7+
def Far():
8+
fahrenheit = float(input("Enter the temperature in Fahrenheit ")) # It will take user input
9+
celsius :float = (fahrenheit - 32) * 5 / 9 # calculation part
10+
print(" Value in Celsius", celsius)
11+
12+
def condition():
13+
cont=int(input((" Enter 1 to continue or else to exit ")))
14+
if cont ==1:
15+
main()
16+
condition()
17+
18+
def main():
19+
print(" To convert Temperatures")
20+
choice=int(input("Enter 1 to convert Celsius to Fahrenheit 0r Enter 2 for vice versa "))
21+
22+
if choice ==1 :
23+
Cel()
24+
25+
elif choice ==2 :
26+
Far()
27+
else :
28+
print(' Wrong choice ')
29+
return
30+
31+
main()
32+
condition()
33+

0 commit comments

Comments
 (0)