1def my_function(name, age = 20):
2 print(name + " is " + str(age) + " years old"
3
4my_function("Mitro") # Mitro is 20 years old
5my_function("Mitro", 26) #Mitro is 26 years old
1class Test:
2 def __init__(self, val, num = 0):
3 self.val = val
4 self.num = num
5
6# you can write this:
7
8t = Test(1)
9print(t.num) # prints 0
10
11# OR this
12
13t = Test(1, 2)
14print(t.num) # prints 2