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
10 changes: 10 additions & 0 deletions break.continue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
for symbol in 'hello world':
if symbol == 'o':
break
print(symbol)


for symbol in 'hello world':
if symbol == 'o':
continue
print(symbol)
1 change: 1 addition & 0 deletions hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello")
5 changes: 5 additions & 0 deletions if.else.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a = 3
if a > 4:
print('hello 4')
else:
print(f'hello {a}')
12 changes: 12 additions & 0 deletions lek_bool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
print(bool(2))

print(bool('good'))

print(bool([1, 4, 5]))

print(bool(0))

print(bool(''))

print(bool([]))
print(bool([[]]))
11 changes: 11 additions & 0 deletions lek_for_while.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

for i in 1, 3, 4:
print(i**2, end=' ')

for i in 1, 3, 4:
print(i**2, end='\n')
for i in 1, 3, 4:
print(i, i**2, sep=' - ')
a = [1, 5, 7, 10]
for i in a:
print(f'{i}**3 = {i**3}')
12 changes: 12 additions & 0 deletions lek_if.2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if 1:
print('hello 1')

a = 3
if a > 1:
print(f'hello {a}')

b = 5
if b == 5:
print(f'hello {b}')


7 changes: 7 additions & 0 deletions lek_if_elif_else.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pupokk = 3
if pupokk > 5:
print('hello 5')
elif pupokk < 2:
print('hello 2')
else:
print('pupokk hello')
9 changes: 9 additions & 0 deletions lek_logic_oper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
a = 3
b = 4
c = 5
if a > 4 and b == 2:
print('good')
elif b > 3 or c == 5:
print('best')
else:
print('bad')
13 changes: 13 additions & 0 deletions lek_range.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

a = range(0, 10, 2)
print(a)
print(type(a))
print(a[3])


a = 'Good'
for i in range(0, 10, 1):
if i < len(a):
print(a[i] + ' - Bad')
else:
print(f'{i}' + ' - Good')
5 changes: 5 additions & 0 deletions lek_while.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

i = 5
while i < 15:
print('i: ', i)
i += 2
7 changes: 7 additions & 0 deletions task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
n = int(input("Введите целое число: "))


if n % 2 == 0:
print("Число четное.")
else:
print("Число нечетное.")
6 changes: 6 additions & 0 deletions task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a = float(input())
b = float(input())
c = int(input())
for i in range(c):
print(a)
a=a*b
6 changes: 6 additions & 0 deletions task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a = int(input())

if a % 400 == 0 or ( a %4 == 0 and a % 100 != 0):
print(f'{a} - високосный год')
else:
print(f'{a} - neвисокосный год')
9 changes: 9 additions & 0 deletions task4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
a = int(input())
b = 0
c = 1
for i in range(a):
f = b+c
print(c, end= '')
c = b
b = f
print()
11 changes: 11 additions & 0 deletions task5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
a = int(input())
b = int(input())
if b == 0:
print('no delit 0')
elif a % b == 0:
print(f'{a}delit {b}')
print('Chastnoe =', a / b)
else:
print(f'{a}no delit {b}')
print('ostatok = ', a%b)
print('Chastnoe = ', a/b)
4 changes: 4 additions & 0 deletions task6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
for i in range(1, 10):
for j in range(1, 10):
print(f"{i * j:4}", end=' ')
print()