Activity 3
Activity 3
Activity 4
print("Player is eligible.")
else:
distance_to_next_station = 200
if remaining_distance <= 0:
Activity 5
else:
Activity 6
Program: Looping Here's the output of the given Python statements:range(1, 8): [1, 2, 3, 4, 5, 6,
7]range(8): [0, 1, 2, 3, 4, 5, 6, 7]range(2, 9, 2): [2, 4, 6, 8]range(10, 0, -2): [10, 8, 6, 4, 2]
Activity 7
****
****
****
****
****
****
Activity 8
# Part a
names = []
for i in range(5):
names.append(name)
# Part b
sorted_names = sorted(names)
# Part c
replace_index = int(input("Enter the index of the name you want to replace (0-4): "))
names[replace_index] = new_name
Activity 9
word_definitions = {
'python': 'A high-level programming language known for its simplicity and readability.',
definition = word_definitions.get(word)
if definition:
print("Definition:", definition)
else:
Activity 10
def calculate_sum(n):
return (n * (n + 1)) // 2
sum_of_series = calculate_sum(n)
# Print the result