How do you print names in Python?

a= [

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
2
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
4
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
8
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
9

Geeks for Geeks
1, 2, 3, 4, 5

Geeks for Geeks
1, 2, 3, 4, 5
1

Geeks for Geeks
1, 2, 3, 4, 5
2
Geeks for Geeks
1, 2, 3, 4, 5
3
Geeks for Geeks
1, 2, 3, 4, 5
4
Geeks for Geeks
1, 2, 3, 4, 5
5
Geeks for Geeks
1, 2, 3, 4, 5
6
Geeks for Geeks
1, 2, 3, 4, 5
7
Geeks for Geeks
1, 2, 3, 4, 5
8

Geeks for Geeks
1, 2, 3, 4, 5
9
1 2 3 4 5
in new line
1
2
3
4
5
0
1 2 3 4 5
in new line
1
2
3
4
5
1

Output

1 2 3 4 5

  • Without using loops: * symbol is use to print the list elements in a single line with space. To print all elements in new lines or separated by comma use sep=ā€\nā€ or sep=ā€, ā€ respectively. 

Python




# Python program to print list

1 2 3 4 5
in new line
1
2
3
4
5
3

Geeks for Geeks
1, 2, 3, 4, 5

a= [

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
2
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
4
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
8
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
9

Geeks for Geeks
1, 2, 3, 4, 5

1 2 3 4 5 
In new line
1
2
3
4
5
9

# Python program to print list0

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6# Python program to print list3# Python program to print list4

Geeks for Geeks
1, 2, 3, 4, 5

# Python program to print list6

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6# Python program to print list9# using for loop0

Geeks for Geeks
1, 2, 3, 4, 5

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6# Python program to print list3# using for loop5= # using for loop7# using for loop8

Geeks for Geeks
1, 2, 3, 4, 5

a0

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6a3# using for loop0

Geeks for Geeks
1, 2, 3, 4, 5

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6# Python program to print list3# using for loop5= =1# using for loop0

Output

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5

  • Convert a list to a string for display : If it is a list of strings we can simply join them using join() function, but if the list contains integers then convert it into string and then use join() function to join them to a string and print the string. 

Python




# Python program to print list

=4

=5

a=[=9

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1[1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1=9
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
9

Geeks for Geeks
1, 2, 3, 4, 5

[6

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6[9
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
00

Geeks for Geeks
1, 2, 3, 4, 5

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
02

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
03

a= [

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
2
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
4
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
8
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
9

Geeks for Geeks
1, 2, 3, 4, 5

1 2 3 4 5
in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
19
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
20
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
22
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
23
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
25

Output

Geeks for Geeks
1, 2, 3, 4, 5

  • Using map : Use map() to convert each item in the list to a string if list is not a string, and then join them: 

Python




# Python program to print list

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
02

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
28

Geeks for Geeks
1, 2, 3, 4, 5

a= [

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
2
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
4
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
8
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
9

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6[9
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
46
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
47
Geeks for Geeks
1, 2, 3, 4, 5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
19
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
50

Geeks for Geeks
1, 2, 3, 4, 5

1 2 3 4 5
in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
53

1 2 3 4 5
in new line
1
2
3
4
5
0
Geeks for Geeks
1, 2, 3, 4, 5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
56
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
46
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
47
Geeks for Geeks
1, 2, 3, 4, 5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
19
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
61

Output

1 2 3 4 5
in new line
1
2
3
4
5

  • Using list comprehension : Use list comprehension to go one by one to each element in list and print. 

Python3




# Python program to print list

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
63

Geeks for Geeks
1, 2, 3, 4, 5

a= [

1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
2
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
4
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
6
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
1
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
8
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
9

[

1 2 3 4 5
in new line
1
2
3
4
5
0
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
80=[9# using for loop0
Geeks for Geeks
1, 2, 3, 4, 5
2
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
85
Geeks for Geeks
1, 2, 3, 4, 5
4
1 2 3 4 5
printing lists separated by commas
1, 2, 3, 4, 5
printing lists in new line
1
2
3
4
5
87

How do I print a name and address in Python?

Introduction.
def personal_details():.
name, age = "Rohit", 25..
address = "Mumbai, Maharashtra, India".
print("Name: {}\nAge: {}\nAddress: {}". format(name, age, address)).
personal_details().

How to print text in Python?

Python print() Function The print() function prints the specified message to the screen, or other standard output device. The message can be a string, or any other object, the object will be converted into a string before written to the screen.

How do you print multiple names in Python?

To easily display single and multiple variables in Python, use the print() statement. For multiple variables, use the comma operators.

How do you print short names in Python?

Program: Input a name and Print the Initials and with surname. for b in range(0,value): if b==0: print(user[0]) elif user[b]==" ": print(user[b+1]) --------This is to print the initials before the surname.