-1
I made a small program in Python that asks the user to type any integer number, right after it shows the Fibonacci sequence (number of times) and then shows the number of even numbers until that determined number that the user typed.
aa = 0
a = 1
fim = int(input('Digite um termo: '))
for n in range (0,fim):
s = (aa + a)
print(s, end = ' → ')
aa = a
a = s
s = 0
while s <= fim:
if s % 2 == 0:
print(s, end=' → ')
s = s + 1
My problem is this, I wanted the result to input=10
(example) were so
>>> %Run q1.py
Digite um termo: 10
1 → 2 → 3 → 5 → 8 → 13 → 21 → 34 → 55 → 89
→ 0 → 2 → 4 → 6 → 8 → 10 →
But the program put it all together:
>>> %Run q1.py
Digite um termo: 10
1 → 2 → 3 → 5 → 8 → 13 → 21 → 34 → 55 → 89 → 0 → 2 → 4 → 6 → 8 → 10 →
How do I separate these prints in two lines? one for Fibonacci and the other for pair counting.
That’s right, I’ll never forget it, thank you!!
– Natanael Ricardo