last lab
This commit is contained in:
19
labPython/lab3/textfile4.py
Executable file
19
labPython/lab3/textfile4.py
Executable file
@@ -0,0 +1,19 @@
|
||||
def fibonachi(num_for_stop:int) -> int:
|
||||
if num_for_stop <= 0:
|
||||
return 0
|
||||
elif num_for_stop == 1:
|
||||
return 1
|
||||
else:
|
||||
return fibonachi(num_for_stop-2) + fibonachi(num_for_stop-1)
|
||||
|
||||
num_end = int(input())
|
||||
|
||||
with open("d.txt", "w") as file:
|
||||
count = 0
|
||||
i=0
|
||||
while count < num_end:
|
||||
num_fib = fibonachi(i)
|
||||
if num_fib%2 == 1:
|
||||
file.write(f"{num_fib}\n")
|
||||
count+=1
|
||||
i +=1
|
||||
Reference in New Issue
Block a user