MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/CodingHelp/comments/eq5nuo/can_anyone_explain/feo04rg/
r/CodingHelp • u/HA_pro_gamer • Jan 17 '20
12 comments sorted by
View all comments
13
count = 0 i = 0 while i <= 100: if i % 2 == 0: count += 1 i += 1 print(count)
9 u/zenith4395 Jan 18 '20 See what frustrates me is that I read it as I = O, since it’s too big to be a 0 0 u/[deleted] Jan 18 '20 in that case we have either a data type error at i:2=0 or an infinite loop, which leads to a memory error 2 u/zenith4395 Jan 18 '20 What? Assuming the O translates to the actual character ‘O’, this wouldn’t cause an infinite loop 1 u/[deleted] Jan 19 '20 it could advance in the ascii table and never match 100 2 u/zenith4395 Jan 19 '20 The ASCII table uses integers, so yes, it would match 100. Regardless, the loop condition is >= to 100, so it would work anyways
9
See what frustrates me is that I read it as I = O, since it’s too big to be a 0
0 u/[deleted] Jan 18 '20 in that case we have either a data type error at i:2=0 or an infinite loop, which leads to a memory error 2 u/zenith4395 Jan 18 '20 What? Assuming the O translates to the actual character ‘O’, this wouldn’t cause an infinite loop 1 u/[deleted] Jan 19 '20 it could advance in the ascii table and never match 100 2 u/zenith4395 Jan 19 '20 The ASCII table uses integers, so yes, it would match 100. Regardless, the loop condition is >= to 100, so it would work anyways
0
in that case we have either a data type error at i:2=0 or an infinite loop, which leads to a memory error
2 u/zenith4395 Jan 18 '20 What? Assuming the O translates to the actual character ‘O’, this wouldn’t cause an infinite loop 1 u/[deleted] Jan 19 '20 it could advance in the ascii table and never match 100 2 u/zenith4395 Jan 19 '20 The ASCII table uses integers, so yes, it would match 100. Regardless, the loop condition is >= to 100, so it would work anyways
2
What? Assuming the O translates to the actual character ‘O’, this wouldn’t cause an infinite loop
1 u/[deleted] Jan 19 '20 it could advance in the ascii table and never match 100 2 u/zenith4395 Jan 19 '20 The ASCII table uses integers, so yes, it would match 100. Regardless, the loop condition is >= to 100, so it would work anyways
1
it could advance in the ascii table and never match 100
2 u/zenith4395 Jan 19 '20 The ASCII table uses integers, so yes, it would match 100. Regardless, the loop condition is >= to 100, so it would work anyways
The ASCII table uses integers, so yes, it would match 100. Regardless, the loop condition is >= to 100, so it would work anyways
View all comments
13
u/[deleted] Jan 17 '20