-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
161 lines (139 loc) · 3.59 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import math
from decimal import Decimal
import random
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
f = "ADSDSDSDSD"
n = [2,6]
# f = f.replace('DS','spam',1)
# d = bytearray(f,'utf-8')
# help(f.replace)
# print(dir(n))
# M = [[1,2,3],[4,5,6],[7,8,9]]
# col2 = [x[1] for x in M]
# print(col2)
# col2 = list(range(5))
# col2 = [[x,x ** 2,x+444] for x in range(-3,3,1)]
# print(col2)
# def count_substring(string, sub_string):
# counter = 0
# for i in range(len(string)):
# if string.count(sub_string, i, i + len(sub_string)) == 1:
# counter += 1
# return counter
# tuple = (('subfirst','subsecond'),'second','third','second')
# print(tuple[2])
# set = {'first','second','firste'}
# print(set)
dictionary = {'name':{'onre':['two','three']}, 'sur': ['surname','cra'], 'alpha':['beta'],'mess':['here ']}
# print(dictionary)
# KS = sorted(dictionary)
# for key in KS:
# print(key + ':' + str(dictionary[key]))
# S1 = set('ramtrre')
# S2 = {'r','s','w'}
# print(S1)
# print(S2-S1)
# class Worker:
# def __init__(self,name,pay):
# self.name = name
# self.pay = pay
# def Raisepay(self,percent):
# self.pay = self.pay*(1+percent*0.01)
# print(self.pay)
#
# Ivan = Worker('Ivanov',100500)
# Ivan.Raisepay(50)
# print(Ivan.name)
l = [1,2,3,4]
l1 = [5,6]
l.append(l1)
print(l)
l.extend(l1)
print(l)
x = '0.1'
print(Decimal(x))
# print(int('0.1')+0.1+0.1+0.1-0.4)
# keys = list(dictionary.keys())
# print(keys)
# print('drink {x} vodka '.format(x=4))
#
# LL = ['first', 'second', 'third', 'forth']
# random.shuffle(LL)
# print(LL)
# i=0
L=[]
# for i in range(3):
# name = input('Enter name ')
# score = input('Enter score ')
#
# L.append([name,score])
# E = ['3','5']
# print(E)
#
# def func1(a):
# return int(a)
#
# print(set(map(func1, E)))
E = '33 c 52'
E.split(' ')
print(E, type(E))
print('saa %s %d' %('d',1))
# a = 'r'
# print(a)
# b = a
# print(b)
# b = b + 'ss'
# print(a,b)
#
# La = [1,2,3,4]
# Lb = La[:]
# print(La,Lb)
# Lb[1] = 'ssdsd'
# print(La,Lb)
#
# Ta = (1,2,3,4)
# Tb = Ta
# print(Ta,Tb)
# Ta += ('ssdsd','sd')
# print(Ta,Tb)
#
# Ta = {13,23,33,43}
# Tb = Ta
# print(Ta,Tb)
# Ta = [1,2]
# print(Ta,Tb)
# print(L)
# D = {}
#
# for v in range(0, len(L)):
# D[L[v][0]] = (L[v][1])
#
# print(D)
#
# DS = D.keys()
# print(DS)
# set = (sum(M[i]) for i in range(4))
#
# print(set)
# s = next(set)
# print(s)
# se = next(set)
# print(se)
# M = [[x,x+1,x+2] for x in range(1,10,3)]
# print(M)
#
# dict = {x:sum(M[x]) for x in range(3)}
# print(dict)
# exec(open('/Users/dmitrybaranov/PycharmProjects/pythonProject1/Test.py'))
#! import Test
# from Test import title
# print(Test.title)
# See PyCharm help at https://www.jetbrains.com/help/pycharm/