12.18 Chapter Assessment

From Foundations of Python ProgrammingGNU FDL 1.3Original pagePython1 class period6 exercises7 graded tests

README.md

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 01 folder and edit main.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 02 folder and edit main.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 03 folder and edit main.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 04 folder and edit main.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 05 folder and edit main.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 06 folder and edit main.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

FolderGradingTests
01Autograded1
02Autograded1
03Autograded1
04Autograded1
05Autograded1
06Autograded2