0

I need someone to explain how to use a while loop for this

#replace the comment in the following code with a while loop . numxs=int(input("How many times should i print the number X? ")) toPrint=' ' #concatecate X to toPrint numxs times. print(toPrint)

21st Jul 2020, 2:49 AM
Adeola Adetilewa
Adeola Adetilewa - avatar
4 Antworten
+ 2
I posted the code below, it works 👍👍 https://code.sololearn.com/c5t8NV67lf3Q/?ref=app
21st Jul 2020, 3:02 AM
Steven M
Steven M - avatar
+ 1
Thanks it does
21st Jul 2020, 3:04 AM
Adeola Adetilewa
Adeola Adetilewa - avatar
0
# something like this? stop=0 numxs=int(input()) toPrint="test" while numxs != stop: print(toPrint) stop+=1
21st Jul 2020, 2:54 AM
Steven M
Steven M - avatar
0
This created an infinite loop
21st Jul 2020, 2:58 AM
Adeola Adetilewa
Adeola Adetilewa - avatar