<variable name> = input(<some prompt string>)This would print the contents of the prompt and return whatever the user typed as a string. (The reading also talks about how to convert this string to numbers, which we'll practice in the next exercise.) The reading also showed you how to print a value to the screen using the following general form
print(<some output string>)
Enter a word: rain
Enter a second word: bow
The compound word is rainbow.
Enter a word: rain
Enter a second word: bow
rain + bow = rainbow.
Enter a number: 4
Enter a second number: 78
82
What year will you graduate? 2016
You will graduate in 2016? Congratulations!
What year will you graduate? 2016Note that to do so, you will need to subtract two numbers, which can be done just as you would probably expect. Don't forget to use int for conversion before doing any arithmetic! Finally, try entering different years when you run this function. Does it work correctly for any given year 2015 or later? If not, please modify your function so that it does.
Congratulations! You have only 1 more year to go!
python> monthMinutes(29) A month with 29 days has 41760 minutes.Hint: Initialize variables such as hoursPerDay, minutesPerHour, etc., before making your final numeric calculation.
python> imageFileSize(800,600) Image width: 800 pixels
Image height: 600 pixels
File size: 1920000 bytes
|
python> convertToCelsius(100) 100 F = 37.7777777778 C
python> makeChange(83)This derivative work was originally authored by Marge Coahran. Copyright © 2015 Jerod Weinman.
Change:
3 quarters
0 dimes
1 nickels
3 pennies
This work is licensed under
a Creative
Commons Attribution-Noncommercial-Share Alike 4.0 International License.