0% found this document useful (0 votes)
77 views2 pages

Assignment 2

The document outlines 17 programming assignments involving tasks like prompting users for input, performing calculations, and displaying output. It includes problems to calculate things like pay, speed, area of a circle, interest, and displaying greetings. The assignments involve using basic operations, variables, input/output, and conditional statements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views2 pages

Assignment 2

The document outlines 17 programming assignments involving tasks like prompting users for input, performing calculations, and displaying output. It includes problems to calculate things like pay, speed, area of a circle, interest, and displaying greetings. The assignments involve using basic operations, variables, input/output, and conditional statements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment - 2

1. Write a program that uses raw_input to prompt a user for their Name and then
welcomes them.

Enter your name: Chuck


Hello Chuck
2. Write a program to prompt the user for hours and rate per hour to compute gross
pay.

Enter Hours: 35
Enter Rate: 2.75
Pay: 96.25
3. Assume that we execute the following assignment statements: width = 17,
height = 12.0
For each of the following expressions, write the value of the expression and the
type (of the value of the expression).
a. width/2
b. width/2.0
c. height/3
d. 4. 1 + 2 * 5
Write program and also Use the Python interpreter to check your answers.
4. Write a program which prompts the user for a Celsius temperature, convert the
temperature to Fahrenheit, and print out the converted temperature.
5. Will the following lines of code print the same thing? Explain why or why not.
x = 7
print(x)
print("x")
6. What happens if you attempt to use a variable within a program, and that variable
has not been assigned a value?
7. Write a program which prompts the user for distance and time, to find the speed
8. Write a program to perform addition, subtraction, multiplication, division, integer
division, and modulo division on two integer numbers.
9. Write a program to perform addition, subtraction, multiplication, division, integer
division, and modulo division on two float numbers.
10. Write a program to calculate area of circle
11. Write a program to print the digit at ones place of a number
12. Write a program to calculate average of two numbers. Print their deviation
13. Write a program to calculate the total amount of money using denomination of Rs.
100, Rs. 50, Rs. 20 and Rs. 10
14. Write a program to calculate simple interest
15. Write a program to find compound interest
16. Write a program which prompts the user for x, y, to find the value of xy
17. Write a program that prompts user to enter first name and last name and then
displays a message Greetings!!! First Name Last Name
18. Write a program to display minutes and second of which prompt the user of hours

You might also like