menu COMPSCI 2120/9642/DIGIHUM 2220 1.0 documentation

Problem Set 5ΒΆ

Problem 5.1

Write a single-line command to print the first 4 characters of a string "Supercalifragilisticexpialidocious"; next, print the 2nd to 7th characters; finally, print the last three characters.

Problem 5.2

Write a function char_is_in(char,string) which returns True if the character char appears in the string string. HINT: Use the in operator.

Problem 5.3

Write a function where_is(char,string) which returns the index of the first occurence of char in string.

Problem 5.4

Write a function called max_of_all_lists_in_list(my_list) which returns the max value from my_list; my_list is a list containing lists of integers. Use [[1,5,2,3,9],[5,2,12,3],[1,5,3]] as your argument (i.e. as your my_list parameter).