Close
Register
Close Window

Demo Exercises from Pitt-Acos

Chapter 2 Python Parsons Problems

Show Source |    | About   «  2.4. jsParsons Python 4   ::   Contents   ::   2.6. jsParsons Python 6  »

2.5. jsParsons Python 5

2.5.1. About

Parson's problems in Python.

2.5.2. ps_python_comparisons

Construct a program that prints out whether variable a is bigger than b.

2.5.3. ps_python_add_to_list

Construct a function that adds a given amount to all items in a list.

2.5.4. ps_python_swap

Construct a program that swaps the values of x and y variables.

2.5.5. ps_python_xor

Construct a program that mimics an XOR gate (exclu- sive or). When input_a and input_b are the same, it should print out 0 and in other cases print out 1.

2.5.6. ps_python_for_odd_or_even

Construct a program that goes through a list of numbers and prints out whether they are odd or even.

2.5.7. ps_python_string_join

Construct a program that prints out a sentence from a given list of words by joining words in a list.

   «  2.4. jsParsons Python 4   ::   Contents   ::   2.6. jsParsons Python 6  »

nsf
Close Window