0% found this document useful (0 votes)
2 views

cs

The document outlines a computer science project by Arman Shaikh on creating a unit converter program using Python, guided by teacher Shankar Rai. The project aims to facilitate conversions between various units of length, weight, and temperature, enhancing understanding of programming concepts. It includes acknowledgments, a project certificate, code snippets, example outputs, and a bibliography.

Uploaded by

tatayatope7
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

cs

The document outlines a computer science project by Arman Shaikh on creating a unit converter program using Python, guided by teacher Shankar Rai. The project aims to facilitate conversions between various units of length, weight, and temperature, enhancing understanding of programming concepts. It includes acknowledgments, a project certificate, code snippets, example outputs, and a bibliography.

Uploaded by

tatayatope7
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

PM SHRI KENDRIYA

VIDYALYA NO.2 AFS


PUNE

COMPUTER SCIENCE
PROJECT
UNIT CONVERTER

SUBJECT – COMPUTER SCIENCE (083)


SUBMITTED BY – ARMAN SHAIKH
GUIDED BY - SHANKAR RAI (PGT CS)
CLASS – 11th A
ROLL No. – 11113

ACADEMIC YEAR –
2024-2025
ACKNOWLEDGMENT
I would like to express my thanks of
gratitude to our Principal, Bharat Bhushan
of KV NO.2,AFS PUNE and to my CS teacher
HARI SHANKAR RAI sir who gave me the
golden opportunity to do this wonderful
project and provided all necessary support
to do project on the topic UNIT
CONVERTER which also allowed me to a
lot of research and I come to know about to
my new things. I am very thankful to them

Secondly, I would like to thank my parents


and friends who helped me a lot to
complete this project.
Arman

CERTIFICATE
This is to certify that Arman Shaikh of class
11A has successfully completed his
python project on the topic UNIT
CONVERTER for the subject Computer
science (083) as prescribed by CBSE under
the guidance of Hari Shankar Rai ,PGT CS,
during the academic year 2024-2025.
INTERNAL PRINCIPAL
EXTERNAL
EXAMINER
EXAMINER

CONTENTS

Sr.NO. TOPIC
1. INTRODUCTION
2. About the
Project
3. CODE
4. OUTPUT
5. Bibliography
and Reference

INTRODUCTION
In today’s interconnected world, the ability
to seamlessly convert between different
units of measurement is essential. From
scientific research to everyday tasks like
cooking or travel, we constantly encounter
situations where we need to translate
values from one unit to another. This
project focuses on developing a versatile
unit converter program that simplifies this
process. The program will provide users
with a user-friendly interface to perform
conversions between various units of
length, weight, and temperature.
This project is designed to enhance
understanding of fundamental
programming concepts, including
input/output operations, conditional
statements, and basic arithmetic
calculations. By implementing a unit
converter, we gain practical experience in
applying these concepts to solve a real-
world problem. The program will be
structured to be modular and extensible,
allowing for easy addition of more unit
conversions in the future. This project
serves as a stepping stone towards
developing more complex applications and
fosters problem-solving skills crucial in
computer science. Furthermore, it
highlights the power of programming to
automate repetitive tasks and improve
efficiency in various fields. The unit
converter aims to be a valuable tool for
anyone needing quick and accurate unit
conversions, demonstrating the practical
applications of computer science in
everyday life.

ABOUT THE PROJECT


This project creates a user-friendly unit
converter program in Python. It allows
users to convert between different units of
length (meters to feet), weight (kilograms
to pounds), and temperature (Celsius to
Fahrenheit). The program utilizes
input/output operations, conditional
statements, and basic arithmetic to
perform the conversions, offering a
practical application of core programming
concepts.

CODE
# Unit Converter Project
# Introduction
Print(“Welcome to the Unit Converter!”)
Print(“This program can convert between
various units of measurement.”)

# Available Conversion Options


Print(“\nAvailable Conversions:”)
Print(“1. Length: Meters to Feet”)
Print(“2. Weight: Kilograms to Pounds”)
Print(“3. Temperature: Celsius to
Fahrenheit”)

# Get User Choice


Choice = input(“Enter the number of the
conversion you want to perform: “)
# Perform Conversion based on User
Choice
If choice == ‘1’: # Meters to Feet
Meters = float(input(“Enter the length in
meters: “))
Feet = meters * 3.281 # Conversion
factor
Print(f”{meters} meters is equal to
{feet:.2f} feet.”) # .2f formats to 2 decimal
places

Elif choice == ‘2’: # Kilograms to Pounds


Kilograms = float(input(“Enter the weight
in kilograms: “))
Pounds = kilograms * 2.205 # Conversion
factor
Print(f”{kilograms} kilograms is equal to
{pounds:.2f} pounds.”)

Elif choice == ‘3’: # Celsius to Fahrenheit


Celsius = float(input(“Enter the
temperature in Celsius: “))
Fahrenheit = (celsius * 9/5) + 32 #
Conversion formula
Print(f”{celsius} degrees Celsius is equal
to {fahrenheit:.2f} degrees Fahrenheit.”)

Else:
Print(“Invalid choice. Please enter a
number from 1 to 3.”)
# Example Usage (Illustrative – not part of
the interactive program)
# meters_example = 10
# feet_example = meters_example * 3.281
# print(f”{meters_example} meters is
equal to {feet_example:.2f} feet.”)

# kilograms_example = 50
# pounds_example = kilograms_example *
2.205
# print(f”{kilograms_example} kilograms is
equal to {pounds_example:.2f} pounds.”)

# Celsius_example = 25
# Fahrenheit_example = (Celsius_example
* 9/5) + 32
# print(f”{Celsius_example} degrees
Celsius is equal to
{Fahrenheit_example:.2f} degrees
Fahrenheit.”)

# End of Program
Print(“\nThank you for using the Unit
Converter!”)

Explanation and Key Improvements:


* Clear Introduction: The program starts
with a welcoming message and explains its
purpose.
* Menu-Driven: It presents a menu of
available conversions, making it user-
friendly.
* Input Validation (Basic): While not full
validation, it checks if the user’s choice is
within the valid range (1-3). More robust
error handling could be added.
* Conversion Logic: The code performs the
correct unit conversions using the
appropriate formulas and conversion
factors.
* Formatted Output: The output is
formatted to two decimal places using f-
strings (e.g., {feet:.2f}) for better
readability.
* Comments: I’ve added comments to
explain the code, which is crucial for your
project.
* Example Usage (Commented out): I’ve
included commented-out example
calculations to demonstrate the
conversion factors. You can uncomment
these to test specific values quickly. These
are not part of the interactive program
execution.
* End Message: The program ends with a
thank you message.
How to Run this Code:
* Save: Save the code as a .py file (e.g.,
unit_converter.py).
* Run from Terminal/Command Prompt:
Open your terminal or command prompt,
navigate to the directory where you saved
the file, and run it using python
unit_converter.py.
This improved version is more organized,
user-friendly, and demonstrates good
coding practices. It’s a great starting point
for your project! You can expand it by
adding more unit conversions, improving
the input validation, or even creating a
graphical user interface (GUI) if you’re
feeling ambitious.

OUTPUT
Welcome to the Unit Converter!
This program can convert between various
units of measurement.
Available Conversions:
1. Length: Meters to Feet
2. Weight: Kilograms to Pounds
3. Temperature: Celsius to Fahrenheit

Enter the number of the conversion you


want to perform: 1
Enter the length in meters: 10
10.0 meters is equal to 32.81 feet.

Thank you for using the Unit Converter!

Another Example (Kilograms to Pounds):


Welcome to the Unit Converter!
This program can convert between various
units of measurement.

Available Conversions:
1. Length: Meters to Feet
2. Weight: Kilograms to Pounds
3. Temperature: Celsius to Fahrenheit

Enter the number of the conversion you


want to perform: 2
Enter the weight in kilograms: 50
50.0 kilograms is equal to 110.25 pounds.

Thank you for using the Unit Converter!

Example with Invalid Input:


Welcome to the Unit Converter!
This program can convert between various
units of measurement.

Available Conversions:
1. Length: Meters to Feet
2. Weight: Kilograms to Pounds
3. Temperature: Celsius to Fahrenheit

Enter the number of the conversion you


want to perform: 4 # Invalid input
Invalid choice. Please enter a number from
1 to 3.

Thank you for using the Unit Converter!


Example (Celsius to Fahrenheit):
Welcome to the Unit Converter!
This program can convert between various
units of measurement.

Available Conversions:
1. Length: Meters to Feet
2. Weight: Kilograms to Pounds
3. Temperature: Celsius to Fahrenheit

Enter the number of the conversion you


want to perform: 3
Enter the temperature in Celsius: 25
25.0 degrees Celsius is equal to 77.00
degrees Fahrenheit.
Thank you for using the Unit Converter!

How to See the Output Yourself:


* Run the code: Save the Python code (as
unit_converter.py, for example) and run it
from your terminal or command prompt
using python unit_converter.py.
* Interact: The program will prompt you for
input. Type in your choices and values, and
press Enter.
* See the results: The program will display
the converted values based on your input.
These examples show the different
scenarios and the corresponding output
you’ll see when you run the program.
Remember to experiment with it yourself
to get a good understanding of how it
works!

BIBLIOGRAPHY
Chat gpt
Gemini
11 CS TEXTBOOK

You might also like