diff --git a/break.continue.py b/break.continue.py new file mode 100644 index 000000000..8e15c60b2 --- /dev/null +++ b/break.continue.py @@ -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) diff --git a/hello.py b/hello.py new file mode 100644 index 000000000..2f9a147db --- /dev/null +++ b/hello.py @@ -0,0 +1 @@ +print("Hello") diff --git a/if.else.py b/if.else.py new file mode 100644 index 000000000..0b81bf9fe --- /dev/null +++ b/if.else.py @@ -0,0 +1,5 @@ +a = 3 +if a > 4: + print('hello 4') +else: + print(f'hello {a}') \ No newline at end of file diff --git a/lek_bool.py b/lek_bool.py new file mode 100644 index 000000000..776b55664 --- /dev/null +++ b/lek_bool.py @@ -0,0 +1,12 @@ +print(bool(2)) + +print(bool('good')) + +print(bool([1, 4, 5])) + +print(bool(0)) + +print(bool('')) + +print(bool([])) +print(bool([[]])) \ No newline at end of file diff --git a/lek_for_while.py b/lek_for_while.py new file mode 100644 index 000000000..22cfb3c01 --- /dev/null +++ b/lek_for_while.py @@ -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}') diff --git a/lek_if.2.py b/lek_if.2.py new file mode 100644 index 000000000..7233255c1 --- /dev/null +++ b/lek_if.2.py @@ -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}') + + diff --git a/lek_if_elif_else.py b/lek_if_elif_else.py new file mode 100644 index 000000000..cf468a872 --- /dev/null +++ b/lek_if_elif_else.py @@ -0,0 +1,7 @@ +pupokk = 3 +if pupokk > 5: + print('hello 5') +elif pupokk < 2: + print('hello 2') +else: + print('pupokk hello') \ No newline at end of file diff --git a/lek_logic_oper.py b/lek_logic_oper.py new file mode 100644 index 000000000..abda3a775 --- /dev/null +++ b/lek_logic_oper.py @@ -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') \ No newline at end of file diff --git a/lek_range.py b/lek_range.py new file mode 100644 index 000000000..24cdb92fc --- /dev/null +++ b/lek_range.py @@ -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') diff --git a/lek_while.py b/lek_while.py new file mode 100644 index 000000000..399073ab7 --- /dev/null +++ b/lek_while.py @@ -0,0 +1,5 @@ + +i = 5 +while i < 15: + print('i: ', i) + i += 2 \ No newline at end of file diff --git a/task1.py b/task1.py new file mode 100644 index 000000000..d8280e4ad --- /dev/null +++ b/task1.py @@ -0,0 +1,7 @@ +n = int(input("Введите целое число: ")) + + +if n % 2 == 0: + print("Число четное.") +else: + print("Число нечетное.") \ No newline at end of file diff --git a/task2.py b/task2.py new file mode 100644 index 000000000..28c146588 --- /dev/null +++ b/task2.py @@ -0,0 +1,6 @@ +a = float(input()) +b = float(input()) +c = int(input()) +for i in range(c): + print(a) + a=a*b \ No newline at end of file diff --git a/task3.py b/task3.py new file mode 100644 index 000000000..695cb3005 --- /dev/null +++ b/task3.py @@ -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високосный год') diff --git a/task4.py b/task4.py new file mode 100644 index 000000000..69b571ab7 --- /dev/null +++ b/task4.py @@ -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() \ No newline at end of file diff --git a/task5.py b/task5.py new file mode 100644 index 000000000..05ebd6d91 --- /dev/null +++ b/task5.py @@ -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) \ No newline at end of file diff --git a/task6.py b/task6.py new file mode 100644 index 000000000..b619a084f --- /dev/null +++ b/task6.py @@ -0,0 +1,4 @@ +for i in range(1, 10): + for j in range(1, 10): + print(f"{i * j:4}", end=' ') + print()