Python Programming Assignment – Lesson: Data Types (Integer, String, Float)
📅 Submission Deadline: 16th May 2025
👉 Upload your Python file to GitHub and submit the link in the lesson's "About" section.
Assignment Objective:
Learn how to use integers, strings, and floats in Python by completing real-life inspired tasks
like storing names, prices, and quantities.
📘 Instructions:
1. Complete all the tasks below in a single Python file.
2. Use comments to explain what each line of code is doing.
3. Save the file as data_types_assignment.py.
4. Upload your code to your GitHub repository.
5. Submit the GitHub link in the "About" section of the lesson before the due date.
✍️ Tasks:
✅ Task 1: Integer
● Create a variable age with your age (as a whole number).
● Print what your age will be in 5 years.
1. # Example
2. age = 14
3. print("In 5 years, you will be", age + 5)
✅ Task 2: String
● Create a variable name with your first name.
● Create a greeting using "Hello, " and your name.
● Print the greeting.
✅ Task 3: Float
● Create a variable height and store your height in meters (e.g., 1.65).
● Print a sentence like: "Your height is 1.65 meters."
✅ Task 4: Combined Use
● Store these in variables:
○ Item: "Book"
○ Quantity: 4 (Integer)
○ Price per item: 12.99 (Float)
● Calculate the total cost (quantity × price).
● Print a sentence like:
4. You bought 4 Books for a total of 51.96 dollars.
✅ Task 5: Challenge Yourself!
Let’s pretend we are building a shopping program:
● Ask the user to enter:
○ Their name
○ An item they want to buy
○ The price per item
○ The quantity
● Then calculate the total price and print:
5. Hello [name]! You bought [quantity] [item]s. Total: [total_price] dollars.
(Hint: Use input() and float() functions!)
📤 Submission:
1. Save your file as data_types_assignment.py.
2. Upload it to your GitHub.
3. Submit the link in the "About" section of the lesson by 16th [Month] 2025.