Avg_ask_comments vs avg_show_comments

Screen Link:

My Code:

total_ask_comments = 0
for row in ask_posts:
    num_comment = int(row[4])
    total_ask_comments += num_comments
    avg_ask_comments = total_ask_comments/len(ask_posts)

total_show_comments = 0
for row in show_posts:
    num_comments = int(row[4])
    total_show_comments += num_comments
    avg_show_comments =  total_show_comments/len(show_posts)
avg_show_comments = "{:.2f}".format(avg_show_comments)

What I expected to happen: avg_ask_comments > avg_show_comments

What actually happened: avg_ask_comments < avg_show_comments


hi @pankyadav89

Just wanted to know, if these codes are inside the for loop or outside?

avg_ask_comments = total_ask_comments/len(ask_posts)

avg_show_comments = total_show_comments/len(show_posts)

If these lines are indented inside respective for loop, can you please try to remove the indentation once and then run code to see the results.