A bounded Fibonacci sequence
Task
The program reads an upper bound - a whole number. While the input is not a whole number, it prints zadaj cele cislo and asks again.
Then it prints a list of all members of the Fibonacci sequence 0, 1, 1, 2, 3, 5, … that are less than or equal to the bound. For a negative bound it is an empty list.
Examples
Input
10
Expected output
[0, 1, 1, 2, 3, 5, 8]
Input
x 1
Expected output
zadaj cele cislo [0, 1, 1]
Rules
Handle the input with
try/except.The
exceptbranch is missing.
After you submit, 4 hidden tests will also check your solution: bound 0, a negative bound, bound 100, a decimal and an exact bound.
Python starts the first time you run code.
Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.
Input (stdin)
Each line = one call to input().
Output
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.