12.18. Chapter Assessment

Write a function called int_return that takes an integer as input and returns the same integer.

Write a function called add that takes any number as its input and returns that sum with 2 added.

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.

Before you keep reading...

Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.

Write a function, accum, that takes a list of integers as input and returns the sum of those integers.

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

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.

You have attempted 1 of 7 activities on this page