+ 2

how to print array of strings

25th Jun 2016, 5:04 PM
Nishant Sardana
Nishant Sardana - avatar
3 Answers
+ 2
if we set ( sports = ['football','basketball','tennis','swimming'] ) we can simply print it by typing : print(sports)
25th Jun 2016, 6:42 PM
Renken Dz
Renken Dz - avatar
+ 2
To print the strings one by one: array = ["Welcome", "to", "my", "kingdom"] # This array is simply an example. ANY array would do! for i in array: print(i) # This code prints each item (in this case, string) in the array one by one. The output: Welcome to my kingdom If you just want to print a specific string, you can just call its position: print(array[3]) The output would be: kingdom
26th Jun 2016, 9:13 AM
Lari Liuhamo
Lari Liuhamo - avatar
0
can we access one by one
26th Jun 2016, 1:38 AM
Nishant Sardana
Nishant Sardana - avatar