Please help me I had typed a list And list as content but I want to print Piyush prajapati Not ['piyish', 'prajapati'] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help me I had typed a list And list as content but I want to print Piyush prajapati Not ['piyish', 'prajapati']

content = [ "piyish" , "prajapati" ] x = 0 while x < 3: print(content) x = x + 1 break Output ['piyish', 'prajapati'] [Program finished]

17th Jul 2020, 8:53 AM
PIYUSH PRAJAPATI
PIYUSH PRAJAPATI - avatar
10 Answers
+ 6
#In place of print(content), write This content = [ "piyush" , "prajapati" ] x = 0 while x < 3: print(*content) x = x + 1 break #It's printing list because you have used list. However, try the above code and one more thing you have written "piyish" there if you want "piyush" Change it. And if you want it 3 times as Ipang said remove the break statement in your code as it breaks the loop from repeating the code
17th Jul 2020, 9:06 AM
Arctic Fox
Arctic Fox - avatar
+ 6
What's the problem in it or what do you want in it.. Also tell us your problem with code
17th Jul 2020, 8:55 AM
Arctic Fox
Arctic Fox - avatar
+ 6
This is a comprehension that can do the task: [print(i,end=' ') for i in content]
17th Jul 2020, 10:25 AM
Lothar
Lothar - avatar
+ 5
The loop runs only once instead of three times (as planned), that is because you put a `break` statement in the loop body. Just remove the `break` statement and it will run three times. (Edit) I misunderstood the question, because the desired output was not specified early on.
17th Jul 2020, 8:56 AM
Ipang
+ 2
print (" ". join(content))
17th Jul 2020, 9:22 AM
Oma Falk
Oma Falk - avatar
+ 1
Thanks bro
17th Jul 2020, 9:07 AM
PIYUSH PRAJAPATI
PIYUSH PRAJAPATI - avatar
+ 1
PIYUSH PRAJAPATI nope standard repertoire. one should know it... ... not pure beginner, but after.
17th Jul 2020, 9:24 AM
Oma Falk
Oma Falk - avatar
0
Please help me I had typed a list And list as content but I want to print Piyush prajapati Not ['piyish', 'prajapati']
17th Jul 2020, 9:00 AM
PIYUSH PRAJAPATI
PIYUSH PRAJAPATI - avatar
0
It kinda tricky?? Oma falk
17th Jul 2020, 9:23 AM
PIYUSH PRAJAPATI
PIYUSH PRAJAPATI - avatar
0
Use the print () tag to get the resulting output
18th Jul 2020, 5:31 AM
blooming Flowers
blooming Flowers - avatar