Logo
  • ГЛАВНАЯ
  • ОБО МНЕ
  • СЕРТИФИКАТЫ
nocip.ssh@mail.ru
2.6.1.9 LAB: Простой ввод и вывод

Цели

  • знакомство с вводом и выводом данных в Python;
  • оценка простых выражений.

Сценарий

Ваша задача - завершить код, чтобы оценить результаты четырех основных арифметических операций.

Результаты необходимо распечатать на консоли.

Возможно, вы не сможете защитить код от пользователя, который хочет разделить на ноль. Ничего страшного, пока не беспокойся об этом.

Протестируйте свой код - дает ли он ожидаемые результаты?

Мы не будем показывать вам никаких тестовых данных - это было бы слишком просто.

Дано

# input a float value for variable a here
# input a float value for variable b here
# output the result of addition here
# output the result of subtraction here
# output the result of multiplication here
# output the result of division here
print("\nThat's all, folks!")




Вывод

Input a value A: 78

Input a value B: 23

This is the result of addition (+) A and B: 101.0
This is the result of subtraction (-) A and B: 55.0
This is the result of multiplication (*) A and B: 1794.0
This is the result of division (//) A and B: 3.0

That's all, folks!


🔁

RetraR — Компьютерные игры для Nintendo Game Boy
Приветствуем всех любителей ретро-игровой индустрии на канале RetraR
RetraR - Computer games for Nintendo Game Boy 🌌🛸👽👾☄️🤖
RetraR - 任天堂ゲームボーイ用コンピュータゲーム 🎮🕹️👾

RetraR
RetraR
Канал ретро компьютерных игр
Контактные данные

Нажимая на кнопку, вы даете согласие на обработку персональных данных

Отправка формы
Подтвердите, что вы не робот
или нажмите Enter

Спасибо за заказ

Ваш заказ принят в обработку. 

Мы свяжемся с вами в ближайшее время


# input a float value for variable a here
a = float(input("Input a value A: "))


# input a float value for variable b here
b = float(input("Input a value B: "))


results_addition = a + b
results_subtraction = a - b
results_multiplication = a * b
results_division = a // b


# output the result of addition here
print("This is the result of addition (+) A and B: ", results_addition)


# output the result of subtraction here
print("This is the result of subtraction (-) A and B: ", results_subtraction)


# output the result of multiplication here
print("This is the result of multiplication (*) A and B: ", results_multiplication)


# output the result of division here
print("This is the result of division (//) A and B: ", results_division)


print("\nThat's all, folks!")

Спасибо за заказ

Ваш заказ принят в обработку. 

Мы свяжемся с вами в ближайшее время.