Thursday, 17 December 2020

Python: Multiple assignments

Using = operator, you can assign values to multiple variables in one line.

 

multiple_assignment.py

id, name, age = 1, "Krishna", 31

print(f"id : {id}, name : {name}, age : {age}")

 

Output

$python3 multiple_assignment.py 
id : 1, name : Krishna, age : 31

 

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment