fork download
  1. # your code goes here
  2. # salem
  3. # жай tipter
  4.  
  5. # int, float
  6. a = 23 #int
  7. b = 23.9 #float
  8. print(a, b)
  9. a = float(a)
  10. b = int(b)
  11. print(a, b)
  12. # bool
  13. f = True # 1 болып саналуы мүмкін
  14. print(f)
  15. # False == 0
  16. #str
  17. s = 'abc'
  18. s1 = "def"
  19. print(s, s1)
  20. # None
  21. print(None)#көбінесе келмейді ентда
  22. #tuple кортеж ішіне тек жай типті элементтерді жазуға болады
  23. t = (1, 2, 9)
  24. print(t)
  25. t = ('a', 'b', 'c')
  26. print(t)
  27. t = (1, 2, 'abc', True)
  28. print(t)
  29. t = (1, 2, (3, 4))
  30. print(t)
  31.  
  32.  
  33. #operations
  34. # int, float
  35. print(2 + 3, 2 -3, 5.6 * 0.1, 45 // 3, 45 / 6, 45 % 6)
  36. # // бүтін бөлу
  37. #bool
  38. print(True and True)
  39. print(True and False)
  40. print(True or False)
  41. print(not True)
  42. #str
  43. #slicing
  44. s = '123abcde456xyz'
  45. print(s[0], s[3], s[-1], s[-4])
  46. print(s[2:7])#бірінші индекс кіреді екінші индекс кірмейді
  47. print(s[2:-3])
  48. print(s[:8])
  49. print(s[4:])
  50. print(s[::2])
  51. print(s[::3])
  52. print(s[::-1])
  53. print(s[4:9:2])
  54.  
  55. #concatenation
  56. print('abc' + 'def')
  57. print('abc' * 3)
  58. #print('abc' - 'a')#error
  59. print(dir(str))
  60. #методы строк
  61. print("abc".capitalize())
  62. print('banana'.count('na'))
  63. print('apple'.find('z'))#-1 егер табылмаса
  64. print('banana'.replace('na', '@', 1))
  65. print('banana'.upper())
  66. print('BananA'.lower())
  67. print('banana'.split('a'))
  68. print('banana is good!'.split())
  69.  
  70. #tuple #slicing
  71. t = (1, 2, 3, 'a', 'b')
  72. print(t[2], t[1:-1], t[::2])
  73. print(dir(tuple))
  74. print(t.count('1'))
  75. #print(t.index(4))#табылмаса қате береді error
  76. print((1,2,3) + ('a', 'b'))
  77.  
  78.  
  79. #input
  80. a = int(input())
  81. print(a * 10)
  82.  
  83. a = input()
  84. print(a + '!')
  85. print(a * 5)
  86.  
Success #stdin #stdout 0.1s 14160KB
stdin
95
nursaya
stdout
23 23.9
23.0 23
True
abc def
None
(1, 2, 9)
('a', 'b', 'c')
(1, 2, 'abc', True)
(1, 2, (3, 4))
5 -1 0.5599999999999999 15 7.5 3
True
False
True
False
1 a z 6
3abcd
3abcde456
123abcde
bcde456xyz
13bd46y
1ad5y
zyx654edcba321
bd4
abcdef
abcabcabc
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
Abc
2
-1
ba@na
BANANA
banana
['b', 'n', 'n', '']
['banana', 'is', 'good!']
3 (2, 3, 'a') (1, 3, 'b')
['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
0
(1, 2, 3, 'a', 'b')
950
nursaya!
nursayanursayanursayanursayanursaya