Been trying to improve my Fibonacci script. Made a few changes regarding actually how it visually looks (has like a minimalist "menu") and some other stuff to avoid it breaking, like not allowing text to be given as input to the amount of numbers it should generate. One of the things I wanted to change was the output to show all in just one line, but kinda been having a hard time doing so.
My code:
count = int(input("How many numbers do you want to generate?"))
a = 0
b = 0
c = 1
i = 0
while i < count:
print(str(c))
a = b
b = c
c = a + b
i = i+1
What I also tried:
Instead of
print(str(c)) I've tried, without any luck:
print("\033[K", str(c), "\r", )
sys.stdout.flush()
Desired output:
1, 1, 2, 3 ,5
Output:
1
1
2
3
5