Nov-22-2023, 08:05 AM
(This post was last modified: Nov-22-2023, 08:05 AM by rob101.
Edit Reason: To add
)
Anthony.
What would you like to change? Or are you simply looking for a better way to write that script?
The first thing to note is this: whenever you see repetitive code lines, it's a sure thing that you need a code loop.
There's a few different ways in which this can be coded, but let's stay with the
What would you like to change? Or are you simply looking for a better way to write that script?
The first thing to note is this: whenever you see repetitive code lines, it's a sure thing that you need a code loop.
There's a few different ways in which this can be coded, but let's stay with the
list
object. You need a list of five values, so that's what your loop should do:print("please enter your 5 marks below") # create an empty array marksList = [] # populate it while len(marksList) != 5: entry = len(marksList) + 1 mark = int(input(f"enter mark {entry}: ")) marksList.append(mark)From here, well please post back, so that we can move this forward. I have to be FAK for a few hours, but I'm sure that someone else will pick this up. If not, I will pick it up when I get done with other things.
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein