Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CurSequence = 1
- NegSequence = 0
- GreatSequence = 0
- while (1==1):
- IntInput = input("Enter a positive integer or quit with 'q': ")
- if str(IntInput) == "q":
- break
- if int(IntInput) < 0:
- print("You entered a negative integer.")
- else:
- LastInt = IntInput
- GreatSequence = CurSequence
- break
- while (1==1):
- if str(IntInput) == "q":
- break
- IntInput = input("Enter a positive integer or quit with 'q': ")
- if IntInput == "q":
- break
- if NegSequence == 3:
- break
- if int(IntInput) < 0:
- print("You entered a negative integer.")
- continue
- else:
- if int(IntInput) > int(LastInt):
- CurSequence = CurSequence + 1
- NegSequence = 0
- LastInt = IntInput
- if CurSequence > GreatSequence:
- GreatSequence = CurSequence
- elif int(IntInput) < int(LastInt):
- NegSequence = NegSequence + 1
- CurSequence = 0
- LastInt = IntInput
- else:
- print("You entered the same number!")
- print("The greatest sequence of numbers was " + str(GreatSequence))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement