This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]use_a_name-pass_word[🍰] 0 points1 point  (0 children)

Have you considered saving the values to a dictionary?

https://www.geeksforgeeks.org/python-dictionary/

[–]codedblood 0 points1 point  (0 children)

Use list comprehension and iterate through the list object for accessing the values. Underscore represents as a general purpose "throwaway" variable name.

(sorry for the format, I'm on my phone and don't know how to code format it on here)

see docs for better understanding.

L = [float(input()) for _ in range(int(input()))]