Close
Close Window

Demo Exercises from Pitt-Acos

Chapter 2 Python Parsons Problems

Show Source |    | About   «  2.1. jsParsons Python 1   ::   Contents   ::   2.3. jsParsons Python 3  »

2.2. jsParsons Python 2

2.2.1. About

Parson's problems in Python.

2.2.2. ps_python_iteration_multiplication

Construct a program that multiples number with 2 in a loop and prints values 1,2,4,8 and finally prints "The end!".

2.2.3. ps_python_calculate_function

Define a function that returns the second value multi- plied by two and added by the first value. The program should print 23 at the end.

2.2.4. ps_python_nested_calls

Define a calculate function and a double function which will return the double of the input value. Then construct a program that first prints out 20 and then 36.

2.2.5. ps_python_recursive_factorial

Define a recursive function that returns the factorial of a given positive integer.

2.2.6. ps_python_class_person

Write a program that defines a class "Person" and prints out "Safiira. Nice to meet you!"

2.2.7. ps_python_modulo_is_even

Construct a function that will return True if a given number is even, otherwise false.

   «  2.1. jsParsons Python 1   ::   Contents   ::   2.3. jsParsons Python 3  »

nsf
Close Window