Create 3 variables, assign numeric values and strings;display them on the screen with and without the print statement.
What will be the output of the following Python statement:
Try to guess the result and type it in you shell to prove your guess.
print 4 - 2 * 2
>>> print 9 / 3
>>> print 9 % 3
>>> print 10 % 3
>>> print 10 ** 4
>>> print 10 ** 2 * 2
Play around with integers and decimals. What happens if you divide an integer with a decimal? How do the results of exercise 2 change if you use decimals instead of integers.
Create a while loop that counts from 1 to 100 and prints out every number in a row.
Create a list with the first names of your family. What data type is best used for the names?
Print out every name in this list with a loop. Which loop type do you choose? Why?
Create a loop that checks if any of your family is called "John". Hint: You must loop through the list and check one element at a time.
Create a dictionary, with the names of your relatives as values and your relationship to them as keys; print out its content. Which Python objects can you use as keys and which as values?
You can also loop through a dictionary; actually you loop through the keys of a dictionary:
for key in dic:
print key # prints out the key
Create a for loop, where you print out all keys of the dictionary you creates in exercise 8 and its corresponding values. The output should look like this:
The order is not important. This is a tough question; so take your time and don't give up.