2.4. jsParsons Python 4¶
2.4.1. About¶
Parson's problems in Python.
2.4.2. ps_python_dict_filter¶
Construct a program that prints out all the circles that are larger than 5.
2.4.3. ps_python_bigger_than¶
Assume that num1 and num2 have been initialized to numbers, so that number1 is bigger. Construct a pro- gram that correctly prints out that number1 is indeed bigger
2.4.4. ps_python_conditionals_temperature¶
Construct a program that outputs “Cold”, when the temperature is 15 degrees Celcius or below. It prints “Moderate” when the temperature is over 15 degrees but no more than 25 degrees. If the temperature is over 25 degrees, it prints “Hot”.
2.4.5. ps_python_printing_file_contents¶
Construct a program that opens up a file and prints out each line of the file.
2.4.6. ps_python_try_except¶
Construct a program that prints out various Celcius temperatures in Fahrenheit and throws an exception if the temperature is below absolute zero.
2.4.7. ps_python_nested_ifs¶
Construct a program using nested if statements that prints out a different sentence depending on the time of day. Night is considered to be before 7 a.m., morning is from 7 a.m. until noon, afternoon is until 5 p.m. and rest is considered evening.