1. Quick self introduction
2. Python assessment (you have to tell, without using IDE or AI, what will be printed for each exercise):
# Exercise 1
my_str = "ABCDEFGH"
print(my_str[1:3] + my_str[5:7])
# Exercise 2
import numpy as np
a_1 = [1, 4]
a_2 = [2, 5]
dot = np.dot(a_1, a_2)
print(dot)
# Exercise 3
def func(a: int, b: int) -> int:
return a + b
try:
result = func(1, "a")
print(result, sep=" ")
except:
print("1b", sep=" ")
finally:
print("1c", sep=" ")
# Exercise 4
def func(name):
name = "A"
name = "B"
func(name)
print(name)
# Exercise 5
nums = range(1, 6)
nums_modified = [x ** 2 for x in nums if x % 2 == 0]
print(sum(nums_modified))