Предмет: Информатика, автор: sashanaum857

Ввести 2 числа. Менше з них подвоїти, а більше поділити на 2. Вивести обидва числа після зміни.

x =int(input('x='))

y =int(input('y='))

if x < y :

x=x*2

y=y/2

else:

x=x/2

y=y*2

print("x=",x)

print("y=",y)
СРОЧНО!!!!!


sashanaum857: срочно!!!!!!!!!!!!!!!!!!!!!!!

Ответы

Автор ответа: illiamorozov1
1

Ответ:

New chat

x =int(input('x='))

y =int(input('y='))

if x < y :

x=x*2

y=y/2

else:

x=x/2

y=y*2

print("x=",x)

print("y=",y)

This code takes two integer inputs x and y from the user, and based on whether x is less than y, performs different arithmetic operations on them. If x is less than y, x is multiplied by 2 and y is divided by 2, and if x is not less than y, x is divided by 2 and y is multiplied by 2. Finally, the updated values of x and y are printed.

However, there is a syntax error in the code. The lines of code that follow the if statement must be indented in Python, otherwise, a IndentationError will occur. Here's a corrected version of the code with proper indentation:

Объяснение:

ОШИБКА В КОДЕ


sashanaum857: дякую
Похожие вопросы
Предмет: Математика, автор: marta8132320
Предмет: Литература, автор: nurgulkhalmuhamd