Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions first
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
text
change sth
6 changes: 6 additions & 0 deletions week02/01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
n = int(input())
ch = n // 60
min = n % 60
if ch >= 24:
ch = ch % 24
print(ch, min)
3 changes: 3 additions & 0 deletions week02/02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
text = str(input())
a = int(input())
print("Hello" + ("," + text)*a)
9 changes: 9 additions & 0 deletions week02/03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
a = int(input())
b = int(input())
c = int(input())
min = a
if b < min:
min = b
if c < min:
min = c
print(min)
6 changes: 6 additions & 0 deletions week02/04.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
v = int(input())
t = int(input())
if v > 0:
print((v * t) % 109)
else:
print((109 + (v * t)) % 109)
12 changes: 12 additions & 0 deletions week02/05.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)


n = int(input())
ans = 0
for i in range(1, n + 1):
ans += factorial(i)
print(ans)
12 changes: 12 additions & 0 deletions week02/06.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
maks = int(input())
prev = int(input())
if maks < prev:
maks, prev = prev, maks
n = int(input())
while n != 0:
if n > maks:
prev, maks = maks, n
elif n > prev:
prev = n
n = int(input())
print(prev)
3 changes: 3 additions & 0 deletions week02/07.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = input().split()
for i in range(0, len(a), 2):
print(a[i])
5 changes: 5 additions & 0 deletions week02/08.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a = input()
s= a.split()
for num in s:
if int(num) % 2 == 0:
print(num)
10 changes: 10 additions & 0 deletions week02/09.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def distance(x1, y1, x2, y2):
dist = ((y2 - y1) ** 2 + (x2 - x1) ** 2) ** (1 / 2)
return dist


x1 = float(input())
y1 = float(input())
x2 = float(input())
y2 = float(input())
print(distance(x1, y1, x2, y2))
57 changes: 57 additions & 0 deletions week07/vector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class Vector:
def __init__(self, x, y):
self.x = x
self.y = y

def __repr__(self):
return 'Vector({}, {})'.format(self.x, self.y)

def __str__(self):
return "Координатное представление вектора:" + '({}, {})'.format(self.x, self.y)

def __add__(self, other):
return self.x + other.x, self.y + other.y

def __lt__(self, other):
return self.x < other.x or self.x == other.x and self.y < other.y

def __eq__(self, other):
return self.x == other.x and self.y == other.y

def __ne__(self, other):
return self.x != other.x or self.y != other.y

def __radd__(self, other):
return self.x + other.x, self.y + other.y

def __iadd__(self, other):
self.x += other.x
self.y += other.y
return self

def __sub__(self, other):
return self.x - other.x, self.y - other.y

def __rsub__(self, other):
return other.x - self.x, other.y - self.y

def __neg__(self):
return self.x, self.y

def __isub__(self, other):
self.x -= other.x
self.y -= other.y
return self

def __bool__(self):
return self.x != 0 and self.y != 0

def __abs__(self):
return ((self.x) ** 2 + (self.y) ** 2) ** (1 / 2)


if __name__ == '__main__':
a = Vector(3, 4)
b = Vector(2, 3)
print(abs(a))