Python: Using function attributes display the names of all arguments
Define a Python function student(). Using function attributes display the names of all arguments.
Sample Solution:
Python Code:
def student(student_id, student_name, student_class):
return f'Student ID: {student_id}\nStudent Name: {student_name}\nClass: {student_class}'
print(student('S122', 'Wilson Medina', 'VI'))
Sample Output:
Student ID: S122 Student Name: Wilson Medina Class: VI
Flowchart:
Python Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a python program which import the abs() function using the builtins module, display the documentation of abs() function and find the absolute value of -155.
Next: Write a Python function student_data () which will print the id of a student (student_id). If the user passes an argument student_name or student_class the function will print the student name and class.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics