It has been a long time since I made a post about the 46 Python exercises, which I started in quiz #5 and quiz # 6, so here I am going to show the next five.
Problem eleven was about using a number n and a character c to generate a string of cs n times. For example, if n = 3 and c = a, the answer should be “aaa”.
I did my code like this:
And it ran like this:
The next problem was about taking a list of integers and creating its histogram:
Exercise 13 consisted on returning the maximum value of a list of numbers. For this, I used Python´s max() method.
The following one was about taking a list of integers and returning a list of their lengths:
Finally, in exercise 15 I had to make a program that would take a list of words and return the length of the longest one:
And that’s it for now, I’ll be showing the rest of the problems I have made in other posts! ❤
One thought on “46 exercises: 11-15”