Skip to main content

Should I take this course?

If you are not sure whether you should take this course, go through the following programming problems. If you feel comfortable with solving them with Python, then you probably don’t need this course.

If you have any doubt, please drop us an email.

Problem 1 (easy)

Write a program that consumes a sequence of numbers representing daily rainfall amounts as entered by a user. The sequence may contain the number -999 indicating the end of the data of interest. Print the average of the non-negative values in the sequence up to the first -999 (if it shows up). There may be negative numbers other than -999 in the sequence.

Problem 2 (easy-medium)

Write a function called is_abecedarian that returns True if the letters in a word appear in alphabetical order (double letters are ok). How many abecedarian words are there in the words.txt file (click here to download).

Source: Think Python - Wikibooks

Problem 3 (medium)

The Ackermann function, A(m, n) is defined:

Ackermann function

Write a function named ack(m, n) that evaluates Ackerman’s function.

Problem 4 (medium)

Write a function find_anagrams(words_path) that return a list of all the lists of words that are anagrams in the words.txt file from problem 2. Here is an example of what the return might look like:

        ['deltas', 'desalt', 'lasted', 'salted', 'slated', 'staled']
        ['retainers', 'ternaries']
        ['generating', 'greatening']
        ['resmelts', 'smelters', 'termless']

Source: Think Python - Wikibooks

University of Potsdam logo