w3resource

Python: Display your details like name, age, address in three different lines

Python Basic: Exercise-37 with Solution

Write a Python program to display your details like name, age, address in three different lines.

Pictorial Presentation:

Display your details like name, age, address in three different lines

Sample Solution:-

Python Code:

def personal_details():
    name, age = "Simon", 19
    address = "Bangalore, Karnataka, India"
    print("Name: {}\nAge: {}\nAddress: {}".format(name, age, address))

personal_details()

Sample Output:

Name: Simon                                                                                                   
Age: 19                                                                                                       
Address: Bangalore, Karnataka, India

Flowchart:

Flowchart: Display your details like name, age, address in three different lines.

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

 

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to add two objects if both objects are an integer type.
Next: Write a Python program to solve (x + y) * (x + y).

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz



Python: Tips of the Day

Try-catch-else construct:

try:
  foo() 
except Exception: 
  print("Exception occured")
else:
  print("Exception didnt occur")
finally:
  print("Always gets here")