r/pythonhelp • u/Educational-Top5330 • May 18 '24
I am confused as to why this won't run
total = 0
average = 0
patients = int(input("how many patients are there"))
height = []
for i in range(0,patients):
element = int(input("enter the height")
height.append(element)
for i in range(0,len(height)):
total = total + height[i]
average = total / patients
print("the average height is " + average)
1
Upvotes
•
u/AutoModerator May 18 '24
To give us the best chance to help you, please include any relevant code.
Note. Do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Repl.it, GitHub or PasteBin.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/KingOfTNT10 May 18 '24
What do you mean by wont run?
1
u/CraigAT May 18 '24
Looks okay assuming you have the correct indentation.
Do you get an error?