Write a program that loops through the numbers from 1 to 20 and prints whether each number is even or odd.
1️⃣ Create a loop from 1 to 20. (2 p.)
2️⃣ Use an if-else statement to check even or odd. (2 p.)
3️⃣ Print each number with the label “even” or “odd”. (1 p.)
Write a program that calculates and prints the sum of all even numbers from 1 to 1000.
1️⃣ Create a loop from 1 to 1000. (2 p.)
2️⃣ Use a condition to select only even numbers. (2 p.)
3️⃣ Calculate and print the final sum. (2 p.)
Write a program that loops through a list (the list will be given next week).
1️⃣ (2 p.)
2️⃣ (1 p.)
3️⃣ (1 p.)
4️⃣ (3 p.)
5️⃣ (3 p.)
6️⃣ (1 p.)
7️⃣ (1 p.)
Write a program that goes through a list of fruits (the list will be given next week) and replaces all occurrences of a specific character (e.g., “a”) in each word with another character (e.g., “o”).
1️⃣ Read/ initialize the list of fruits. (1 p.)
2️⃣ Loop through each fruit and replace a character. (4 p.)
3️⃣ Print each modified fruit name. (1 p.)
Write a program that:
1️⃣ (2 p.)
2️⃣ (2 p.)
3️⃣ (1 p.)
4️⃣ (1 p.)
Description:
In this task, you will practice iterating over a DataFrame and stopping a search as soon as a condition is met. This time, you will search only by last name.
Preparation:
my_lastname
containing your own last name.found
, initialized as False
.Steps:
my_lastname
.
found = True
and stop the loop immediately.found
:
No registration found for user {xxx}. You are not yet registered for the course "Base Python 2".
{xxx}
with your actual my_lastname
variable.1️⃣ (1 p.)
2️⃣ (1 p.)
3️⃣ (2 p.)
4️⃣ (6 p.)
5️⃣ (5 p.)
—
Description:
In this advanced mini-game, you will play a “lucky string draw” duel against the computer!
Imagine you both have access to a magical bag containing 100 surprise words stored in a DataFrame.
You will receive this DataFrame next week.
Hint: Think carefully about how you access the word from the DataFrame!
DataFrame Structure:
Index
: 1 to 100Word
: string valuesSteps:
1️⃣ (1 p.)
2️⃣ (1 p.)
3️⃣ (4 p.)
4️⃣ (8 p.)
5️⃣ (1 p.)
Description:
You will work with the worldcities.csv
file (SimpleMaps).
Instructions:
1️⃣ You will receive the download link to the World Cities dataset next week.
👉 Use the free version.
2️⃣ Unzip and note the path to worldcities.csv
.
3️⃣ Load it into a pandas DataFrame and print all column names.
4️⃣ Filter cities in Europe using:
5️⃣ Print the city names from the filtered DataFrame.
6️⃣ Sort the DataFrame by population
in descending order.
7️⃣ Create a bar chart (Matplotlib) for the top 10 largest cities:
1️⃣ (1 p.)
2️⃣ (1 p.)
3️⃣ (2 p.)
4️⃣ (4 p.)
5️⃣ (1 p.)
6️⃣ (2 p.)
7️⃣ (4 p.)
Description:
Create a base class Vehicle
with common attributes such as color
, year
, engine
, name
, and model
.
Subclasses:
type
(e.g., “limousine”, “cabrio”, “coupe”).print_type()
that prints the car’s type.max_load_kg
that defines how many kilograms the truck can carry.print_max_load()
that prints this load capacity.Data:
type
.max_load_kg
.Steps:
Vehicle
with attributes.Car
with the extra attribute and method.Truck
with the extra attribute and method.Car
and Truck
objects from the respective DataFrames.1️⃣ Define the base class Vehicle
with common attributes. (2 p.)
2️⃣ Define the subclass Car
with extra attribute and method. (3 p.)
3️⃣ Define the subclass Truck
with extra attribute and method. (3 p.)
4️⃣ Load both CSV files and create object lists. (3 p.)
5️⃣ Print total vehicle count and “VW” count. (2 p.)
6️⃣ Create a bar chart for vehicles older than 2000, with legend. (2 p.)
Bonus Task: 15 p. (not included in final score)
"""
Description:
This program solves Task X from the thesis assignment.
It includes:
- A loop that processes a sequence or list.
- A condition to check certain properties of elements (e.g., number properties or string checks).
- Printing or saving specific results based on conditions.
Please adjust this description to fit your specific task and explain clearly what is being calculated.
"""
# Example of a loop (replace with your actual loop)
for item in my_list:
# Check a condition (replace with your actual condition)
if some_condition:
# Add a comment explaining what happens here
pass
else:
# Another comment for alternative case
pass
# Finally, print or return results with a clear explanation
✍️ Good comments are rewarded!
For each task, you can receive an extra 0.5 points for clear, well-structured comments.
These points are not included in the main grade calculation, but they can help you if you are just below a grade boundary.💡 For example: If you have 38 points (below passing level), but you wrote very good comments, you can receive enough extra points to pass (grade 4).
👉 So it is always worth it to write clear and meaningful comments!
⭐ The points you collect from the bonus task are not included in the main grade calculation.
However, if your total points are just below a higher grade level, I will count your bonus task points to help you reach the better grade.It is completely your choice whether you want to try the bonus task or not — but it can be a great opportunity to improve your final result!