A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

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

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

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now