Screen Link:
https://app.dataquest.io/m/356/guided-project%3A-exploring-hacker-news-posts/1/introduction
My Code:
total_ask_comments = 0
for post in ask_posts:
total_ask_comments += int(post[4])
avg_ask_comments = total_ask_comments / len(ask_posts)
print(avg_ask_comments)
What I expected to happen:
It worked perfectly fine and produced the result as avg_ask_comments = 14.03 in the morning, but i had to close the system and then when i started again it showed as value error.
What actually happened:
ValueErrorTraceback (most recent call last)
<ipython-input-24-7c08fe5a41af> in <module>()
3
4 for post in ask_posts:
----> 5 total_ask_comments += int(post[4])
6
7 avg_ask_comments = total_ask_comments / len(ask_posts)
ValueError: invalid literal for int() with base 10: 'H'