Print the text Hello, World! to the screen.
Hint: use the print() function with the text inside quotation marks.
Print your name, your age, and where you are from — each on its own line.
Hint: store each piece of information in a variable, then use f-strings to print them.
Your teacher Thanasis was born in 1980. If you are younger than him, print I am younger than Thanasis by X years. If you are older, print I am older than Thanasis by X years.
Hint: define your own birth year as a variable, then compare it to 1980 using an if/else statement.
Print the sentence: When I was born, Thanasis was X years old. Calculate X from the birth years.
Hint: subtract Thanasis's birth year (1980) from your own birth year to find the age difference.
Create a list containing the names of five of your best friends, then print the whole list.
Hint: use square brackets and separate each name with a comma.
Using the list from Exercise 5, loop over it and print each friend's name on its own line, like: My friend: Maria.
Hint: use a for loop and an f-string inside it.
Create a dictionary of Greek Prime Ministers and the year each first took office, using the data below. Then loop through it and print only the ones who took office after the year you were born.
The data to enter into your dictionary:
| Prime Minister | Year took office |
|---|---|
| Konstantinos Karamanlis | 1974 |
| Georgios Rallis | 1980 |
| Andreas Papandreou | 1981 |
| Konstantinos Mitsotakis | 1990 |
| Kostas Simitis | 1996 |
| Kostas Karamanlis | 2004 |
| Giorgos Papandreou | 2009 |
| Loukas Papadimos | 2011 |
| Antonis Samaras | 2012 |
| Alexis Tsipras | 2015 |
| Kyriakos Mitsotakis | 2019 |
Chapter Navigation
Move between chapters.