Python Lab - 22.11.2022
Python Lab - 22.11.2022
2022
Regular – 23.11.2022
d. Write a program to calculate parking charges of a vehicle. Read the hours and minutes
when the vehicle enters the parking lot. When the vehicle is leaving enter its leaving
time. Calculate the difference between the two timings to calculate the number of hours
and minutes for which the vehicle was parked. Finally calculate the charges based on
following rules and then display the result on the screen.
Vehicle Name Rate till 3 hours Rate after 3 hours
Truck / bus 20 30
Car 10 20
Cycle/Motor cycle/Scooter 5 10
e. Write a program that accepts the current date and date of birth of the user. Then calculate
the age of the user and display it on the screen. Note that the date should be displayed in
the following format specified as dd/mm/yy.
f. Write a program to read month of the year as an integer. Then display the name of the
month.
g. Write a program to read a 5-digit number and then display the number in the following
formats…for example, if the user entered 12345, the result should be
12345 1
2345 12
345 123
45 1234
5 12345
h. Write a simple python program the displays the following powers of 2, one per line:2 1, 22,
23, 24, 25, 26, 27, 28.
i. Write a program to generate the following pattern.
i. * * * * *
* *
* *
* *
* * * * *
ii. $ * * * *
* $ *
* $ *
* $ *
* * * * $
iii. $ * * * $
* $ $ *
* $ *
* $ $*
$ * * * $
iv. *
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
i. 1
2 1 2
3 2 1 2 3