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

Python PS - 1

This document contains a problem sheet with 12 programming problems for a Python programming lab. The problems include writing programs to: add two numbers, calculate the area of a circle, print a name in reverse order, calculate simple interest, convert between Celsius and Fahrenheit, determine if a number is even or odd, check if a year is a leap year, sum the digits of a four-digit number, sort three integers, calculate tax and tip for a meal, and determine coin denominations for a cash change amount.

Uploaded by

sneha
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)
98 views

Python PS - 1

This document contains a problem sheet with 12 programming problems for a Python programming lab. The problems include writing programs to: add two numbers, calculate the area of a circle, print a name in reverse order, calculate simple interest, convert between Celsius and Fahrenheit, determine if a number is even or odd, check if a year is a leap year, sum the digits of a four-digit number, sort three integers, calculate tax and tip for a meal, and determine coin denominations for a cash change amount.

Uploaded by

sneha
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/ 1

PSG COLLEGE OF TECHNOLOGY

DEPARTMENT OF APPLIED MATHEMATICS AND COMPUTATIONAL


SCIENCES
PYTHON PROGRAMMING LAB
PROBLEM SHEET 1

1. Write a Python program to add two numbers.


2. Write a Python program which accepts the radius of a circle from the user and compute
the area.
3. Write a Python program which accepts the user's first and last name and print them in
reverse order with a space between them.
4. Write a Python program to calculate the area of a circle.
5. Write a Python program to calculate simple interest.
6. Develop a Python program to convert Celsius to Fahrenheit and vice-versa for a
particular range.
7. Write a program that reads an integer from the user. Then your program should display
a message indicating whether the integer is even or odd.
8. Write a program that reads a year from the user and displays a message indicating
whether or not it is a leap year.
9. Develop a program that reads a four-digit integer from the user and displays the sum of
the digits in the number. For example, if the user enters 3141 then your program should
display 3+1+4+1=9.
10. Create a program that reads three integers from the user and displays them in sorted
order (from smallest to largest). Use the min and max functions to find the smallest and
largest values. The middle value can be found by computing the sum of all three values,
and then subtracting the minimum value and the maximum value.
11. The program that you create for this exercise will begin by reading the cost of a meal
ordered at a restaurant from the user. Then your program will compute the tax and tip
for the meal. Use your local tax rate when computing the amount of tax owing. Compute
the tip as 18 percent of the meal amount (without the tax). The output from your
program should include the tax amount, the tip amount, and the grand total for the meal
including both the tax and the tip. Format the output so that all of the values are
displayed using two decimal places.
12. Consider the software that runs on a self-checkout machine. One task that it must be
able to perform is to determine how much change to provide when the shopper pays for
a purchase with cash. Write a program that begins by reading a number of cents from
the user as an integer. Then your program should compute and display the
denominations of the coins that should be used to give that amount of change to the
shopper. The change should be given using as few coins as possible. Assume that the
machine is loaded with pennies, nickels, dimes, quarters, loonies and toonies

You might also like