0% found this document useful (0 votes)
1 views3 pages

Python Worksheet12

The document outlines a worksheet for a Python project aimed at creating a temperature conversion tool between Celsius and Fahrenheit. It includes the aim, required software, a detailed procedure with code, and expected learning outcomes such as basic Python coding and operator usage. The project is intended for a student named Amarjeet Raj in the Computer Science & Engineering department.

Uploaded by

shubham kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views3 pages

Python Worksheet12

The document outlines a worksheet for a Python project aimed at creating a temperature conversion tool between Celsius and Fahrenheit. It includes the aim, required software, a detailed procedure with code, and expected learning outcomes such as basic Python coding and operator usage. The project is intended for a student named Amarjeet Raj in the Computer Science & Engineering department.

Uploaded by

shubham kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Worksheet 1
Student Name: Amarjeet Raj UID: 23BCS13589
Branch: BE - CSE Section/Group: 809 - B
Semester: 3 Date of Performance: 06/08/2024
Subject Name: Python Subject Code: 23CSP-201

1. Aim:
To create a a temperature conversion tool to help users convert between
Celsius and Fahrenheit scales.

2. Requirements (Hardware/Software):
Programmiz, GBD online compiler

3. Procedure:
def celsius_to_far(celsius): return
(celsius * 9/5) + 32

def fahrenheit_to_cel(fahrenheit):
return (fahrenheit - 32) * 5/9

def get_temperature_input(check):
while True:
try:
temp = float(input(check))
return temp
except ValueWrong:
print("Invalid input. Please enter a numeric value.")

def main():
while True:
print("\nTemperature Converter")
print("1. Convert Celsius to Fahrenheit")
print("2. Convert Fahrenheit to Celsius")
print("3. Exit")

choice = input("Choose the conversion direction (1/2/3): ").strip()

if choice == '1':
celsius = get_temperature_input("Enter temperature in Celsius: ")
fahrenheit = celsius_to_far(celsius)
print(f"{celsius}°C is {round(fahrenheit, 1)}°F")

elif choice == '2':


fahrenheit = get_temperature_input("Enter temperature in Fahrenheit: ")
celsius = fahrenheit_to_cel(fahrenheit)
print(f"{fahrenheit}°F is {round(celsius, 1)}°C")

elif choice == '3':


print("Exiting the temperature converter.")
break

else:
print("Invalid choice. Please select 1, 2, or 3.")

if name == " main ":


main()
4. Output:

5. Learning Outcome:
 Learnt basic python coding.
 Learnt using operators

You might also like