Home | All Fwiends | Random | Online | Music | Blog | Search

chezdeeno's Blog

"𝕔𝕙𝕖𝕫 rules"
Female
13 years old
United States
Last Login: 1624933824000
Contacting chezdeeno
Message
Report
Add
Block
All Blogs (10/10)
1622774910000

silly mistake

im bored, so why not tell you a silly mistake that you should never do in Python.

{The Python code. (I didn't feel like taking a screenshot, so I just pasted it)}

emptyList=[]
max=100
number=101
while number <= max:
emptyList.append(number) <[picture ig]
number=number+1
sum=0
for thing in emptyList:
print(thing)
sum=sum+thing
print(sum)

So, don't make a list where the max is 100 and the number is 101. I spent ages trying to figure out why the code wouldn't work. Then I realized: 101 is bigger than 100!
The code never ran, because the equation was never true. 101 would never be greater than 100.
The moral of the story is, 101 is bigger than 100. Thank you for coming to my TED talk.

Please login to leave a comment.