Lab Programming Assignment - 1
Lab Programming Assignment - 1
Programming Assignment – 1 : Learning Python – Interactive Mode and Simple Python Programs (CO7,K3)
20.2.2024
Learning Outcomes:
You will be able to familiarize the following basic features of Python
Data type declarations
I/O statements
Operators and expressions
Python as Interpreter
Interactive Mode
1. Create a variable named num1 with some integer value and display the value & its datatype.
2. Create another variable named num2 with some integer value and display its datatype. Use the same
variable to store a floating value and write your inference.
10. Find the output of num1 raised to power of num2 11. Get the input from the user and display the
value.
1. Anjana is traveling from city P to city Q. The distance between the two cities is a variable obtained as input,
because she would like to use the equation for other cities also. She knows that she will be travelling 3/4th of
the distance at a speed of 40 miles per hour, and that the remaining will be travelled at 55 miles per hour.
Calculate the time that it will take to travel from one city to the next.
2. Develop a temperature conversion utility as part of a weather data processing system. The utility will be
used to convert temperature data between Celsius and Fahrenheit units to ensure consistency in temperature
measurements for meteorological data analysis. The program should have the following features:
a. Should accept a temperature value and unit identifier (Celsius or Fahrenheit) as input and compute the
temperature value in the opposite unit.
b. Ensure the temperature conversions are accurate to at least one decimal place to maintain precision in
weather analysis.
3. Develop a program to calculate the bill amount for items in an online shopping cart. The program should
allow users to input the following details for each item:
• Quantity sold
• Item value (price per unit)
• Discount percentage
ICS1261 – Software Development and Practice using Python
Practice using Python Lab Assignments
Batch: 2023-2028 Course: 5 Year Integrated M.Tech(CSE) AY: 2023-24 (EVEN)
• Tax rate
The program should then calculate and display the detailed bill summary, including the total before tax,
discount amount, tax amount, and the final bill amount.
The bill should be in the following format:
******************* BILL **********************
Quantity Sold: 20
Price per item: Rs.300
***********************************************
Amount: Rs.6000
***********************************************
Discount: Rs. 600
Discounted Total: Rs.5400
Tax: Rs. 648
***********************************************
Total Amount Rs.6048
***********************************************
4. In digital world colors are specified in Red-Green-Blue (RGB) format, with values of R, G, B varying on an
integer scale from 0 to 255. In print publishing the colors are mentioned in Cyan-Magenta-Yellow-Black (CMYK)
format, with values of C, M, Y, and K varying on a real scale from 0.0 to 1.0. Write a program that converts RGB
color to CMYK color as per the following formulae:
Note: If the RGB values are all 0, then the CMY values are all 0 and the K value is 1.