Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 1.23 KB

File metadata and controls

27 lines (16 loc) · 1.23 KB

CA04 - Introduction to Functions

Course: Web Application Development Using Python (ICTC5)
Instructor: George Khoury
Revision: 1
Last updated: 12-07-2020
Submission Date: No submission required.

Problems

  1. Create a function check_ten(n1, n2) which returns a Boolean True if the sum of the numbers is 10.

  2. Create a function sum_ten(n1, n2) which returns a Boolean True if the sum of the numbers is 10. Otherwise, return the actual sum value.

  3. Create a function first_upper(astring) which returns the first letter in the string in upper case.

  4. Create a function last_two(astring) which returns the last two characters as a tuple. If there are less than two characters, return the value "Error".

  5. Create a function seq_check(numbers) which when given a list of integers, returns True if the sequence [1,2,3] appears somewhere in that list.

  6. Create a function compare_length(s1, s2) which returns the difference in length between the strings.

  7. Create a function sum_or_max(my_list), given a list, if the length of the list is even return the sum of the list. If the length is odd, return the maximum value in that list.

Solutions

You can find suggested solutions to the problems above here.