Created
September 21, 2025 07:11
-
-
Save timpamungkas/359a4a72130284d60715b12922ad01bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def something(n): | |
| sequence = [0, 1] | |
| while len(sequence) < n: | |
| sequence.append(sequence[-1] + sequence[-2]) | |
| return sequence[:n] | |
| try: | |
| n = int(input("Enter how many numbers you want: ")) | |
| if n <= 0: | |
| print("Please enter a positive integer.") | |
| else: | |
| print(f"First {n} numbers:", something(n)) | |
| except ValueError: | |
| print("Invalid input. Please enter an integer.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment