Q:

Assign a different name to function and call it through the new name using python programming

belongs to collection: Python Functions Exercises

0

Assign a different name to function and call it through the new name

Below is the function display_student(name, age). Assign a new name show_tudent(name, age) to it and call it using the new name.

Given:

def display_student(name, age):
    print(name, age)

display_student("Emma", 26)

You should be able to call the same function using

show_student(name, age)

All Answers

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

Hint:

Assign a different name to function using the assignment (=) operator.

fun_name = new_name

Solution:

def display_student(name, age):
    print(name, age)

# call using original name
display_student("Emma", 26)

# assign new name
showStudent = display_student
# call using new name
showStudent("Emma", 26)

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

total answers (1)

Generate a Python list of all the even numbers bet... >>
<< Write a python program to create a recursive funct...