You're wondering what it means to write a repeat and get up to five pieces of data?
This means that the task of receiving data should be + repeated + up to 5 times.
It's like a pun, but there's an important difference. Basically, what you have to do is take an input, which means that it has to be repeated, up to five iterations.
Do you understand? Please don't move on until this is understood.)
What do you do with a maximum of 5 iterations?
There are two ways. The first method is:
The second method is:
Do you understand that? (If not, please don't go down.)
How do we implement method number one? In Python, infinite iterations are implemented as while
.
inputs = []
inTheLoop = True
while inTheLoop :
nput = input('). Type "Stop" and you'll stop. You can enter up to five.')
ifput == 'Stop':
inTheLoop = False
else :
inputs.append(nput)
inTheLoop = len(inputs) < 5
print(inputs)
How do we implement method number two? In Python, finite iterations are assumed to be for
.
inputs = []
for x in range(1, 5) :
nput = input('input'! Type "Stop" and you'll stop! You can only enter up to 5!')
ifput == 'Stop':
break
else :
inputs.append(nput)
print(inputs)
Try running the sauce, try fixing it like this, and try studying it.
820 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
565 PHP ssh2_scp_send fails to send files as intended
572 Uncaught (inpromise) Error on Electron: An object could not be cloned
580 GDB gets version error when attempting to debug with the Presense SDK (IDE)
558 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.