This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
os.system("cls") | |
# Завдання на один простий цикл while/for (мінімум 5 будь-яких задач): | |
# ПОЧАТОК КОДУ ЗАДАЧІ | |
print("\tЗАВДАННЯ I.3\n") | |
# Загадати випадковим чином 100 цілих чисел у діапазоні від -100 до 100. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Задачі на if-else, if-elif-else | |
# ПОЧАТОК КОДУ ЗАДАЧІ | |
print("\tЗАВДАННЯ II.1\n") | |
# Ввести три числа і знайти найменше серед них. | |
try: | |
number_one = float(input("Введіть перше число: ")) | |
number_two = float(input("Введіть друге число: ")) | |
number_three = float(input("Введіть третє число: ")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Складні задачі з обробкою даних | |
"""# НИЖЧЕНАВЕДЕНИЙ КОД ЗАПРАЦЮЄ, ЯКЩО ПРИБРАТИ ПОТРІЙНІ ЛАПКИ! | |
print('\tЗАВДАННЯ IV.1\n') | |
# Розрахувати загальну масу всіх планет Сонячної системи. Обчислити | |
# середнє арифметичне мас планет. Потім — масу кожної планети в | |
# процентному співвідношенні, якщо взяти за 100% загальну масу всіх | |
# планет. У скільки разів маса найбільшої планети більша, ніж сума мас | |
# усіх інших планет? Усі результати — показати на екрані. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Завдання 1. Цитати великих драматургів. | |
print("To be\n\n\tor not\n\n\t\tto be...\n\n\t\t\t\\ William Shakespeare \\") | |
# Завдання 2. Програма показує на екрані календар поточного місяця. | |
#Правда, у Python ніби є досконаліші методи. | |
print('\n\n ГРУДЕНЬ 2024') | |
print("ПН ВТ СР ЧТ ПТ СБ НД") |
NewerOlder