For the Guided Project in Course 2 of Step 1 of the Data Science in Python Track, Im having a problem to convert the number of comments which is a string into an integer

Screen Link:

Your Code: ```total_ask_comments = 0

for row in ask_posts:
nc = row[4]
nc = (nc)
total_ask_comments+= nc

avg_ask_comments = float(total_ask_comments/total_ask_comments.len())


What I expected to happen: Count the average number of comments

What actually happened: ValueError: could not convert string to float: ‘h’

Hi @inziyadad and welcome the community
You just forget to use int() to convert string to integer in this code

not sure what the .len() is meant to do in this case - total_ask_comments is an integer, which has no “len” attribute. From the context you can probably mean “ask_posts.len()” which would give you your average.