Advertisement
chudypakir

Tworzenie słownika z inputa

Jan 17th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1.  
  2. g = ['styczen', 'luty', 'marzec', 'kwiecien', 'maj'] # to jest wpisane w programie
  3. x = [1, 2, 3, 4, 5]
  4. f = {}
  5. print(g)
  6. i = 0
  7. print('Przychody za rok 2018')
  8.  
  9. # a to jakby tworzy słownik, gdzie wartość idzie z inputa.
  10.  
  11. while i < 4:
  12. a = {}
  13. a[g[i]] = str(input('wartosc'))
  14. i = i + 1
  15. y = {}
  16. y = a
  17. y[g[i]] = str(input('wartosc'))
  18. i = i + 1
  19. z = {}
  20. z = y
  21. z[g[i]] = str(input('wartosc'))
  22. i = i + 1
  23. j = {}
  24. j = z
  25. j[g[i]] = str(input('wartosc'))
  26. i = i + 1
  27. print(j)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement