.. This file is part of the OpenDSA eTextbook project. See
.. http://opendsa.org for more details.
.. Copyright (c) 2012-2020 by the OpenDSA Project Contributors, and
.. distributed under an MIT open source license.

.. avmetadata::
   :author: Hamza Manzoor
   :requires:
   :satisfies: Python Basics
   :topic: Parsons Python


jsParsons Python 4
==================

About
-----------------------

Parson's problems in Python.

ps_python_dict_filter
---------------------------------
Construct a program that prints out all the circles that are larger than 5.

.. extrtoolembed:: 'ps_python_dict_filter'
   :learning_tool: mastery-grid-jsparsons-python

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

.. extrtoolembed:: 'ps_python_bigger_than'
   :learning_tool: mastery-grid-jsparsons-python

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”.

.. extrtoolembed:: 'ps_python_conditionals_temperature'
   :learning_tool: mastery-grid-jsparsons-python

ps_python_printing_file_contents
-------------------------------------
Construct a program that opens up a file and prints out each line of the file.

.. extrtoolembed:: 'ps_python_printing_file_contents'
   :learning_tool: mastery-grid-jsparsons-python

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.

.. extrtoolembed:: 'ps_python_try_except'
   :learning_tool: mastery-grid-jsparsons-python

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.

.. extrtoolembed:: 'ps_python_nested_ifs'
   :learning_tool: mastery-grid-jsparsons-python


