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

Python Lab - 22.11.2022

The document contains a lab assignment with multiple programming problems: 1. Write programs to calculate several mathematical series. 2. Write a program to validate user input of words based on length. 3. Write a program to calculate electricity bill amounts based on consumption tiers. 4. Write a program to calculate vehicle parking charges based on time parked and vehicle type. 5. Write additional programs to calculate age from dates, display month names, format numbers, generate patterns, and calculate employee pay.

Uploaded by

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

Python Lab - 22.11.2022

The document contains a lab assignment with multiple programming problems: 1. Write programs to calculate several mathematical series. 2. Write a program to validate user input of words based on length. 3. Write a program to calculate electricity bill amounts based on consumption tiers. 4. Write a program to calculate vehicle parking charges based on time parked and vehicle type. 5. Write additional programs to calculate age from dates, display month names, format numbers, generate patterns, and calculate employee pay.

Uploaded by

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

Lab III – SS – 22.11.

2022

Regular – 23.11.2022

a. Write a program to sum the series


i. 12 /1 + 22 / 2 + 32 / 3+………. n2 /n.
ii. – x + x2 – x3 + x4 + …
iii. 1 + (1+2) + (1+2+3) + …
iv. 1 – x + x2 / 2! – x3 / 3! + …
b. Write a program that prompts the user to enter five words. If the length of any word is
less than 6 characters, then it asks the user to enter it again. However, if the word is of 6
or more characters, then it displays it on the screen.
c. Write a program to calculate electricity bill based on following information
Consumption Unit Rate of charge
0-150 Rs 3 per Unit
151-350 Rs 100 plus Rs3.75 per Unit exceeding
150 units
301-450 Rs 250 plus Rs 4 per unit exceeding 350
units
451-600 Rs 300 plus Rs 4.25 per unit exceeding
450 units
Above 600 Rs 400 plus Rs 5 per unit exceeding 600
units

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

j. Write programs to implement the following sequence of numbers.


1, 8, 27, 64, …
-5, -2, 0, 3, 6, 9, 12, …
-2, -4, -6, -8, -10, -12, …
1, 4, 7, 10, …
k. An employee’s total weekly pay is calculated by multiplying the hourly wage and
number of regular hours plus any overtime pay which in turn is calculated as total
overtime hours multiplied by 1.5 times the hourly wage. Write a program that takes as
inputs the hourly wage, total regular hours and total overtime hours and prints an
employee’s total weekly pay.

You might also like