Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exercise 2.2 Write a program that uses raw_input to prompt a user for their name and then
- welcomes them.
- a ='Enter your name:'
- b = raw_input(a)
- print "Hello" ,b
- Exercise 2.3 Write a program to prompt the user for hours and rate per hour to compute gross
- pay.
- a='Enter Hours:'
- b=raw_input(a)
- c='Enter Rate:'
- d=raw_input(c)
- print "Pay", int(b)*float(d)
- Exercise 2.4 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).
- 1. width/2 =8 - int
- 2. width/2.0=8.5 - float
- 3. height/3=4.0 - float
- 4. 1 + 2 * 5=11 -int
- Exercise 2.5 Write a program which prompts the user for a Celsius temperature, convert the
- temperature to Fahrenheit and print out the converted temperature.
- a="Please enter the temperature value( C ): "
- b= raw_input(a)
- print "Converted value: ", float(b)*1.8+32
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement