Advertisement
Mr_D3a1h

Hm3

Dec 4th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. //Task3 lab 18-23
  2. #18.1
  3. def print_shrug_smile():
  4. print('¯\\_(ツ)_/¯')
  5. def print_ktulhu_smile():
  6. print('{:€')
  7. def print_happy_smile():
  8. print('(͡° ͜ʖ ͡°)')
  9. '''
  10.  
  11. '''
  12. #18.2
  13. t=False
  14. i=0
  15. b=""
  16. def ask_password():
  17. pas=input()
  18. global t
  19. if pas=='password' and not(t):
  20. t=True
  21. b="Пароль принят"
  22. return b
  23. elif i>=3 and not(t):
  24. t=True
  25. b="В доступе отказано"
  26. return b
  27. else:
  28. t=False
  29. return ""
  30. while i>=0:
  31. b=ask_password()
  32. i+=1
  33. if t:
  34. print(b)
  35. '''
  36.  
  37. '''
  38. #18.3
  39. f1=1
  40. f2=1
  41. t=True
  42. g=0.0
  43. i=0
  44. def golden_ratio(i):
  45. j=0
  46. f1=1
  47. f2=1
  48. while j<i-2:
  49. f3 = f1 + f2
  50. f1=f2
  51. f2=f3
  52. j+=1
  53. g=f2/f1
  54. print(f2/f1)
  55. print('444444444444')
  56. return g
  57. while t:
  58. i=int(input())
  59. g=golden_ratio(i)
  60. print(g)
  61. print('=======')
  62. '''
  63.  
  64.  
  65. #18.4
  66.  
  67. '''
  68. g=''
  69. def bracket_check(test_string):
  70. i=0
  71. a=b=0
  72. for c in test_string:
  73. if c=='(':
  74. a+=1
  75. elif c==')':
  76. b+=1
  77. if a==b:
  78. g="YES"
  79. return g
  80. else:
  81. g="NO"
  82. return g
  83. '''
  84. #'''
  85. g=''
  86. def bracket_check(test_string):
  87. i=j=0
  88. a=b=0
  89. for c in test_string:
  90. i+=1
  91. if c=='(':
  92. for v in test_string[i:]:
  93. j+=1
  94. if v==')':
  95. test_string= test_string[:i-1]+test_string[i:i+j-1]+test_string[i+j:]
  96. break
  97. print(test_string)
  98. '''if
  99. g="YES"
  100. return g
  101. else:
  102. g="NO"
  103. return g
  104. '''
  105. test_string=input()
  106. k=len(test_string)
  107. g=bracket_check(test_string)
  108. print(g)
  109.  
  110. '''
  111. #18.5
  112. def equation(a,b):
  113. x1, y1, x2, y2 = map(float, (a + ";" + b).replace(',', '.').split(';'))
  114. if x1 == x2:
  115. print(x1)
  116. elif y1 == y2:
  117. print(y1)
  118. else:
  119. k = (y2 - y1) / (x2 - x1)
  120. print(k, y2 - k * x2)
  121. '''
  122.  
  123. '''
  124. #18.6
  125. def line(s,t):
  126. k, b = map(float, s.replace('x', ' ').split(' '))
  127. x, y = map(float, (t).split(';'))
  128. if y == k * x + b:
  129. print("True")
  130. else:
  131. print("False")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement