Найти в Дзене

Упражнения 4й главы

Задание 1 total = 0
for i in range(1, 6):
error = int(input(f'#{i} Введите количество ошибок: '))
total += error
print('Всего количество ошибок: ', total) Задание 2 for run in range(10, 35, 5):
print(run * 4.2) Задание 3 total = 0
exit = '+'
sum = int(input('Введите сумму денег на месяц: '))
while exit != '-':
rashod = int(input('Введите суммы статьи расхода: '))
total += rashod
exit = input('Еще?')
if (sum - total) >= 0:
print('У вас осталось: ', sum - total)
else:
print('Перерасход: ', sum - total) Задание 4 speed = int(input('Введите скорость в км/ч: '))
hours = int(input('Введите время в часах: '))
print('Час\t\t', 'Расстояние')
print('---------------------')
for i in range(1, hours+1):
print(f'{i}\t\t{i * speed}') Задание 5 total = 0
years = int(input('Введите количество лет: '))
for i in range(years):
print('Год #', i + 1)
for y in range(12):
mm = int(input('Введите количество осадков в мм: '))
total += mm
print('Вс

Задание 1

total = 0
for i in range(1, 6):
error = int(input(f'#{i} Введите количество ошибок: '))
total += error
print('Всего количество ошибок: ', total)

Задание 2

for run in range(10, 35, 5):
print(run * 4.2)

Задание 3

total = 0
exit = '+'
sum = int(input('Введите сумму денег на месяц: '))
while exit != '-':
rashod = int(input('Введите суммы статьи расхода: '))
total += rashod
exit = input('Еще?')
if (sum - total) >= 0:
print('У вас осталось: ', sum - total)
else:
print('Перерасход: ', sum - total)

Задание 4

speed = int(input('Введите скорость в км/ч: '))
hours = int(input('Введите время в часах: '))
print('Час\t\t', 'Расстояние')
print('---------------------')
for i in range(1, hours+1):
print(f'{i}\t\t{i * speed}')

Задание 5

total = 0
years = int(input('Введите количество лет: '))
for i in range(years):
print('Год #', i + 1)
for y in range(12):
mm = int(input('Введите количество осадков в мм: '))
total += mm
print('Всего осадков: ', total)
print('Средний размер осадков: ', total/12)

Задание 6

for i in range(21):
print(f'Температура по Цельсию: {i}\tТемпература по Фаренгейту: {9/5*i+32:.1f}')

Задание 7

total = 0
money = 1
days = int(input('Введите количество дней: '))
for i in range(1, days + 1):
print(f'День: {i}\tЗП: {money}')
total = total + money
money *= 2

Задание 8

numbers = 0
total = 0
while numbers >= 0:
total += numbers
numbers = int(input('Введите число: '))
print('Сумма чисел', total)

Задание 9

for x in range(1, 26):
total = x * 1.6
print(f'Год #{x}\t мм {total:.1f}')

Задание 10

COST = 145000
total = COST * 4
for i in range(1, 6):
print(f'Год #{i}\t Плата {total:.1f}')
total = total + total * 0.03

Задание 11

DIETA = 1.5
ves = int(input('Введите ваш вес: '))
for i in range(1, 7):
ves = ves - DIETA
print(f'Месяц #{i}\t Вес {ves}')

Задание 12

total = 1
number = int(input('Введите число факторал: '))
for i in range(1, number + 1):
total *= i
print(total)

Задание 13

count = int(input('Количество организмов: '))
sredneSutUvelPopul = int(input('Среднесуточное увеличение популяции в процентах: '))
kolvoDneyRazmn = int(input('Количество дней на размножение: '))
for i in range(1, kolvoDneyRazmn + 1):
print(f'День #{i:<10}\t Популяция {count:<10.2f}')
count = count + count * sredneSutUvelPopul / 100

Задание 14

for i in range(7):
for y in range(7, 0, -1):
if y <= (7 - i):
print('*', end='')
print('')

Задание 15

for i in range(6):
print('#', end='')
for y in range (i):
print(' ', end='')
print('#')