A function is a reusable code for specific action. Here we are defining two different function.
- First one is to say hello to the user after asking their name with their age.
- Second function is to calculate square of a number.
#defining a function #function_1 def say_hi(name, age): print("Hello" + name + ", you are " + age) #asking user for their name and age: input name = input("What is your name?") age = input("What is your age?") #calling the function say_hi(name, age) #function_2 def sq(num): return num*num #calling the function and printing the result print(sq(5))