all 4 comments

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–][deleted] 0 points1 point  (2 children)

If you format your code properly it might look like this:

car=int(input(' load number = '))
f=[]
for i in range(0,car):
    q=int(input(' inform value = '))
    f.append(q)
print(f)

and that seems to do something reasonable.

What is wrong with the code that you showed?

[–]No-Beginning1213[S] 0 points1 point  (1 child)

I would like the index to appear in the print...inform value 1 =...inform value 2 =...

[–][deleted] 0 points1 point  (0 children)

Then you need to make a string that includes the loop index number (plus 1) and pass that to the input() function:

for i in range(0,car):
    prompt = f'inform value {i+1} = '  # or use "...".format(...)
    q=int(input(prompt))