• Предмет: Информатика
  • Автор: veraskripka2
  • Вопрос задан 4 месяца назад

ЛЮДИ СРОЧНО ПОМОГИТЕ С ИНФОРМАТИКОЙ!!!!5 класс
Створіть проект для перевірки уміння знаходити різницю, добуток 2 чисел.​

Ответы

Ответ дал: DK404
0

Ответ:

Python:

Якщо суть лежить у знаходженні різниці та добутку двох чисел:

a, b = map(float, input("Enter a, b values with spaces.\n>> ").split())

ex = a-b, a*b

print("Result:", *ex)

Якщо суть лежить у перевірці користувача на вміння знаходження різниці та добутку чисел:

from random import randint

while 1:

a = randint(1, 100)

b = randint(1, 100)

print(f"Ex: {a}-{b}, {a}*{b}?\nAnswer:")

correct = [a-b, a*b]

try:

a, b = map(int, input(">> ").split())

except:

print("Error.\nProgram finished.")

break

print("Correct! = )\n" if a == correct[0] and b == correct[1] else "Incorrect! = (\n")

Объяснение:

Сподіваюсь що допомогла.

Ответ дал: UkraineTopQQE
0

def difference_product(a, b):

   difference = a - b

   product = a * b

   return difference, product

a = float(input("Enter the first number: "))

b = float(input("Enter the second number: "))

diff, prod = difference_product(a, b)

print("The difference of the two numbers is:", diff)

print("The product of the two numbers is:", prod)

Вас заинтересует