Given a sequence of integer numbers ending with the number 0. Determine the length of the widest fragment where all the elements are equal to each other.
The following code works. However, if I un-indent the "if statement" in red, some cases do not work. I don't see how this should affect how the program operates.
The following code works. However, if I un-indent the "if statement" in red, some cases do not work. I don't see how this should affect how the program operates.
n, k = int(input()), int(input()) streak1, streaksum = 1, 1 while k != 0: if n == k: streak1 += 1 # Why does unindenting the following change results? if streak1 >= streaksum: streaksum = streak1 else: streak1 = 1 n, k = k, int(input()) print(streaksum)