Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. ile = int(input("Wpisz ile ma byc wpisanych liczb: "))
  2. lista = []
  3.  
  4. def tribo(n):
  5.     x1, x2, x3 = 0, 1, 2
  6.     lista2 = [0, 1, 2]
  7.     while x3 < n:
  8.         suma = x1 + x2 + x3
  9.         x1 = x2
  10.         x2 = x3
  11.         x3 = suma
  12.         lista2.append(x3)
  13.     return lista2
  14. if 0 > ile:
  15.     print("BLAD")
  16. else:
  17.     for _ in range(ile):
  18.         n = 0
  19.         if 0 <= n <= 1000000000000:
  20.             n = int(input("Liczba: "))
  21.             lista.append(n)
  22.     for i in range(ile):
  23.         x1 = lista[i]
  24.         if x1 in tribo(n):
  25.             print(str(lista[i]) + '\tTAK')
  26.         elif x1 < 0:
  27.             print("BLAD")
  28.         else:
  29.             print(str(lista[i]) + '\tNIE')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement