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

Python Codes

Uploaded by

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

Python Codes

Uploaded by

Manaswi G
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Department of CSE, PES University

UE24CS151A-Python for Computational Problem Solving


Laboratory Week 3

Problem Statements

1. Input the base (b) and height (h) of a triangle and calculate its area where
Area of triangle =0.5* b * h

2. You are traveling to Kenya, if 1 Kenyan shilling = 0.65 Indian rupee. Calculate how many
shillings you will have based on the input in Indian Rupees.

3. A grocery store offers a 10% discount on all purchases. Write a program that asks the
user for the total amount of their purchase, applies the discount and prints the total.

4. You need to introduce yourself to your new classmates. What will you say as an ice
breaker?
Display it in the format: My name is _____ and a fun fact about me is ____

5. You go out for dinner with your friends and need to split the bill equally, how will you do
so by taking input of the bill amount and number of friends?

6. You have a certain amount of total work(n) that needs to be shared among a fixed
number of workers m. Write a program to calculate the amount of work for each worker
and how much extra work is left. Take input for no. of work and no. of workers.

eg:
n = 100
m=6

work on each worker = 16


extra work left = 4

7. Tiling of a rectangular floor is performed. Write a program that calculates the number of
tiles required and the total cost to tile the entire floor. Take the dimensions of the floor
and the size and price of each tile as input from the user. Also consider labor charges.
Department of CSE, PES University
UE24CS151A-Python for Computational Problem Solving
Laboratory Week 3

8. Two persons A and B are conducting a Chemical experiment. In which A is user element
D and E in ratio of 2:1 and B uses the ratio of 4:3, calculate the mass of the compound if
each generates a 1 mole gram of substance given that the mass of D is 1 unit(amu) and
E is 5 units(amu). Take the values from the user.
Hint - Consider using split() method on the input string
eg-
"1:2".split(":") # [‘1’,’2’]
a,b = "1:2".split(":") # a <- '1' ; b <- ‘2
a,b = int(a), int(b) # type casting char/string to integers

9. Given a 4 digit integer no. , display the individual digit & compute the sum of digits.

10. You are asked to color quarter of a circle withreed, one third of the remaining with blue
and rest in yellow, find the area covered by each color and perimeter of each color
(include inner boundaries also ). Take radius as input.

11. You've just celebrated your birthday, and you're curious about how many months, days,
and hours you've been alive. Write a Python program that takes your age(in years) as
input and prints your age in months and days.

12. Imagine you've just opened a savings account at your local bank. You're curious how
much interest you'll earn after a few years. Write a Python program that calculates the
simple interest based on the amount you've deposited, the bank’s interest rate, and the
number of years you plan to keep the money in the account.

13. You’re planning a vacation to a different country, but their weather forecasts are in
Celsius, and you’re more familiar with Fahrenheit. Write a Python program to help you
convert temperatures from Celsius to Fahrenheit so you can pack accordingly for your
trip! (use the formula: F = C * 9/5 + 32)

14. You’re baking a cake, but the recipe you’re following is for 12 servings, and you need to
make enough for a different number of people. Write a Python program that takes the
number of servings you want to make and adjusts the ingredients accordingly. If the
recipe calls for 2 cups of sugar for 12 servings, calculate how many cups of sugar you'll
need for the number of servings entered by the user.

15. You're throwing a pizza party for your friends, and you want to make sure everyone gets
an equal number of slices. Write a Python program that takes the number of pizzas,
slices per pizza, and the number of people attending the party as input, and calculates
how many slices each person gets. Also, calculate how many slices will be left over.

You might also like