Def-Keyword

Wed 12 November 2025
#  created : 20250111
#  https://www.scientecheasy.com/2022/09/reserved-keywords-in-python.html/
#  def keyword
def func():
    print("Inside Function")
func()
Inside Function
#  return keyword
def func_return():
    x = 20
    return x

def func_no_return():
    y = 50

    return y
print(func_return())
20
print(func_no_return())
50
def func():
    x = 0
    for i in range(5):
        x += i
        yield x
for i in func():
    print(i)
0
1
3
6
10


Score: 10

Category: python-basics