Skip to content
Closed
1 change: 1 addition & 0 deletions Hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print('Hello world')
3 changes: 3 additions & 0 deletions Lesson_1/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Lesson_1/.idea/Lesson_1.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Lesson_1/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Lesson_1/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Lesson_1/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Lesson_1/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Lesson_1/info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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.


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')

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
19 changes: 19 additions & 0 deletions Lesson_1/task_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Поработайте с переменными, создайте несколько, выведите на экран.
# Запросите у пользователя некоторые числа и строки и сохраните в переменные,
# затем выведите на экран.
a = 10
b = 45.23
c = a + b
d = a - b
x = c / d
print(a)
print(b)
print(c)
print(d)
print(x)

name = input('Please, enter your name: ')
print("Hi, %s!" % name)
i = int(input('Please, enter a random number: '))
a = i + i * i
print('Thank you very much. The answer is: %d' %a)
8 changes: 8 additions & 0 deletions Lesson_1/task_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Пользователь вводит время в секундах.
# Переведите время в часы, минуты, секунды и выведите в формате чч:мм:сс.
# Используйте форматирование строк.
Interval = int(input('Please, enter the time interval in seconds: '))
H = Interval // 3600
M = (Interval - H * 3600) // 60
S = Interval - (H * 3600 + M * 60)
input('If your time interval is equal to %d than the current time is: ' % (Interval) + '%02d:%02d:%02d' % (H, M, S))
11 changes: 11 additions & 0 deletions Lesson_1/task_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Узнайте у пользователя число n.
# Найдите сумму чисел n + nn + nnn.
# Например, пользователь ввёл число 3.
# Считаем 3 + 33 + 333 = 369.

n = int(input('Please, enter a random value = '))
x = str(n)
nn = x + x
nnn = x + x + x
cal = n + int(nn) + int(nnn)
print('Based on your value: %d ' % n + 'the result of the calculation is = %d' % cal)
14 changes: 14 additions & 0 deletions Lesson_1/task_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Пользователь вводит целое положительное число.
# Найдите самую большую цифру в числе.
# Для решения используйте цикл while и арифметические операции.
val = int(input('Please, enter positive value: '))
max_val = val % 10
num = val
while num > 0:
dgt = num % 10
if dgt > max_val:
max_val = dgt
if max_val == 9:
break
num = num // 10
print(f'The largest digit in {val} is = {max_val}')
18 changes: 18 additions & 0 deletions Lesson_1/task_5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Запросите у пользователя значения выручки и издержек фирмы.
# Определите, с каким финансовым результатом работает фирма.
# Например, прибыль — выручка больше издержек,
# или убыток — издержки больше выручки. Выведите соответствующее сообщение.
# Если фирма отработала с прибылью, вычислите рентабельность выручки. Э
# то отношение прибыли к выручке. Далее запросите численность сотрудников
# фирмы и определите прибыль фирмы в расчёте на одного сотрудника.

rev = float(input('Please enter revenue of the company: '))
cos = float(input('Please enter costs of the company: '))
inc = rev - cos
if inc > 0:
print('The company is profitable.')
print(f'Return on revenue is: {inc / rev: .2f}')
staff = int(input('Please enter the number of employees:'))
print(f'Profit per employee is: {rev / staff: .2f}')
else:
print('The company is unprofitable.')
15 changes: 15 additions & 0 deletions Lesson_1/task_6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Спортсмен занимается ежедневными пробежками.
# В первый день его результат составил a километров.
# Каждый день спортсмен увеличивал результат
# на 10% относительно предыдущего. Требуется определить номер дня,
# на который результат спортсмена составит не менее b километров.
# Программа должна принимать значения параметров a и b и
# выводить одно натуральное число — номер дня.

a = int(input('Please enter the current distance value '))
b = int(input('Please enter the distance you would like to run '))
ad = 1 # ad = amount of the days
while a < b:
a = 1.1 * a
ad += 1
print(f'If you increase your distance by 10% you will be able to run2 {b} km in {ad} days')