Advertisement
Nenogzar

test

Feb 25th, 2024
1,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def numbers(num=1):
  2.     num += 1
  3.     return num
  4.  
  5.  
  6. print(numbers())
  7. print(numbers())
  8. print(numbers())
  9. print(numbers())
  10. print("_____________")
  11.  
  12.  
  13. # Това е проблемното
  14. def numbers1(numb=[0, 1, 2]):
  15.     for k in range(len(numb)):
  16.         numb[k] += 1
  17.     return numb
  18.  
  19.  
  20. print(numbers1())
  21. print(numbers1())
  22. print(numbers1())
  23. print(numbers1())
  24. print("_____________")
  25.  
  26.  
  27. def numbers2(numb=[0, 1, 2]):
  28.     numb = [x + 1 for x in numb]
  29.     return numb
  30.  
  31.  
  32. print(numbers2())
  33. print(numbers2())
  34. print(numbers2())
  35. print(numbers2())
  36. print("_____________")
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement