ِA Python program to create a function that takes two arguments name and age and print their value

برمجة بايثون | Python programming 


مهني|Professional
  • 2025-03-23

Create a function in Python

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

 

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)
Python

 

هل كان الشرح مفيد؟

avatar
adnan s

 

  • حضوري وجها لوجه في الرياض/السعوديةSA
  • عن بعد/اونلاين
  • شروحات مشابهة

    • برمجة بايثون | Python programming
    • برمجة | Programming
    • برمجة سي شارب | c# programming
    • برمجة جافا | Java programming
    • برمجة بي اتش بي | Php programming
    • برمجة html | Html programming
    • برمجة سي اس اس | Css programming
    • برمجة روبي | Ruby programming
    محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
    ماهو التخصص الذي تبحث عنه؟
    اكتب هنا...