Issue
count = [0 for i in range(1000)]
Can anyone explain this line? What do count
and 0
mean in this code? I'm not sure how this code works.
Solution
Search list comprehension.
- if you want to print all the numbers in this range, put "i" in place of 0:
count = [i for i in range(1000)]
- if you add the numbers of this range:
count = sum([i for i in range(1000)])
Answered By - Thales
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.