12.18 Chapter Assessment
From Foundations of Python ProgrammingGNU FDL 1.3Original pagePython1 class period6 exercises7 graded tests
12.18 Chapter Assessment
Exercise 1
Write a function called int_return that takes an integer as input and returns the same integer.
Open the
01folder and editmain.py. Run Tests checks it.
Exercise 2
Write a function called add that takes any number as its input and returns that sum with 2 added.
Open the
02folder and editmain.py. Run Tests checks it.
Exercise 3
Write a function called change that takes any string, adds "Nice to meet you!" to the end of the argument given, and returns that new string.
Open the
03folder and editmain.py. Run Tests checks it.
Exercise 4
Write a function, accum, that takes a list of integers as input and returns the sum of those integers.
Open the
04folder and editmain.py. Run Tests checks it.
Exercise 5
Write a function, length, that takes in a list as the input. If the length of the list is greater than or equal to 5, return "Longer than 5". If the length is less than 5, return "Less than 5".
Open the
05folder and editmain.py. Run Tests checks it.
Exercise 6
You will need to write two functions for this problem. The first function, divide that takes in any number and returns that same number divided by 2. The second function called sum should take any number, divide it by 2, and add 6. It should return this new number. You should call the divide function within the sum function. Do not worry about decimals.
Open the
06folder and editmain.py. Run Tests checks it.
For teachers
12.18 Chapter Assessment
Students read Foundations of Python Programming's “Chapter Assessment” in CS Room and work through its 6 Python coding exercises (6 graded).
- Time: 1 class period
- Tests: 7 in 6 graded exercises, set up for you when you import the lesson
Exercises
| Folder | Grading | Tests |
|---|---|---|
01 | Autograded | 1 |
02 | Autograded | 1 |
03 | Autograded | 1 |
04 | Autograded | 1 |
05 | Autograded | 1 |
06 | Autograded | 2 |