Advertisement
are_you_sure

Untitled

May 26th, 2022
746
330 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Подержите мою клавиатуру!
  2.  
  3.  
  4. def foo(a, b, *, c):
  5.     pass
  6. print(foo(1,2,3, 4))
  7.  
  8.  
  9. print(set(range(3))[0])
  10.  
  11.  
  12. def foo():
  13.     try:
  14.         raise ZeroDivisionError
  15.     except ZeroDivisionError:
  16.         return print('bla bla')
  17.     finally:
  18.         print("I'll be back")
  19. print(foo())
  20.  
  21.  
  22. print({f'{k} = {v}' for k, v in {'a': 'a', 'b': 'b', 'c': 'c'}.items()})
  23.  
  24.  
  25. def foo():
  26.     for x in ['a', 'b', 'c']:
  27.         pass
  28.     [x for x in [1, 2, 3]]
  29.     print(x)
  30. print(foo())
  31.  
  32.  
  33. next((print(x) for x in range(3) if x))
  34.  
  35.  
  36. a = 42
  37. def foo():
  38.     if False:
  39.         a = 1
  40.     print(a)
  41. print(foo())
  42.  
  43.  
  44. l = list(range(5))
  45. l[:3] = l
  46. print(l)
  47.  
  48.  
  49. # Ну и на закуску. Вопрос конечно некорректный, но в пичарме он мне стоил нервов...
  50. class Foo:
  51.     def int(self):
  52.         self.x = 'x'
  53. f = Foo()
  54. print(f.x)
Advertisement
RAW Paste Data Copied
Advertisement