Q:

Write a python program to create a function that takes two arguments, name and age, and print their value.

belongs to collection: Python Functions Exercises

-28

Create a function in Python

Write a program to create a function that takes two arguments, name and age, and print their value.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Hint:

  • Use the def keyword with the function name to define a function.
  • Next, take two parameters
  • Print them using the print() function
  • Call function by passing name and age.

Solution:

# demo is the function name
def demo(name, age):
    # print value
    print(name, age)

# call function
demo("Ben", 25)

 

Explanation:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a python program to create function func1() ... >>