3 ms·
Now I understand it. I wasn't aware one could append a subscript operator after a litteral string. I also didn't know of the second : role. Thank you. But what
by chmike 14y ago
Now I understand it. I wasn't aware one could append a subscript operator after a litteral string. I also didn't know of the second : role. Thank you.
But what do you get if x is 0 ? As I now uneerstand it, you would get "fizzbuzz". Shouldn't the list start at value 1 ? So shouldn't the range be (1, 101) instead of (101) ?
- mburst 14y agoYou're correct. That was my mistake. Here's the updated version: for x in range(1,101):print"Fizz"[x%34:]+"Buzz"[x%54:]or x I basically just removed the extra colons and added 1, to the range so that it starts at 1. lifeisstillgood was spot on with the reasoning that this works.