Quiz # 6

This quiz consisted of the next five exercises from the page of quiz # 5.

In problem number six I had to add and multiply the elements in a list. My programming teacher helped me do this by making me think first about the process, step by step, the program has to make in order to get the expected result.

When I finished, it looked like this:

quiz6-1

And ran like this:

quiz6-1run

Problem number seven was about reversing a string. I learned how to do that by looking into these two pages:

http://stackoverflow.com/questions/931092/reverse-a-string-in-python

https://docs.python.org/2/whatsnew/2.3.html#extended-slices

This is how I did it:

quiz6-2

And how it ran:

quiz6-2run

The following problem was about indicating if a word is a palindrome (like ‘radar’) or not. After doing problem seven, eight was easy:

quiz6-8

Here is how it ran:

quiz6-8run

Problem nine was about indicating if a value was or not in a list, without using the operator in. Here is how I did it:

quiz6-9

And how it ran:

quiz6-9run

And finally, problem number ten was about comparing two lists and indicating if they had an element in common. After doing problem nine, this one was simple enough:

quiz6-10

Here is how it ran:

quiz6-10run

3 thoughts on “Quiz # 6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s