Вопрос задан 04.11.2023 в 04:38. Предмет Информатика. Спрашивает Болтунов Егор.

Найди ошибки в представленных ниже кодах программы . Язык Python Код 1 a= int inpit() b= int

intut() t=A+B print (c) Код 2 a=8:b=118 c := a+b print(c) Код 3 a=int (input()) k=3⋅(a+b)-4ab t= a⋅b print (k) ; print (t)
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Бакытбекова Нуршырак.

Код 1.

a= int inpit()   ~~~~ int(input())

b= int intut()  ~~~~ int(input())   ~ Так правильно

t=A+B  ~~~~  Существуют лишь переменные <a> и <b> , но переменных А и В нигде нет, их попросту не существует, и это все же ошибка.

print (c)  ~~~~  Переменной <c> не существует. Ошибка.

Код 2 .

a=8:b=118  ~~~~~~ между a=8 и b=118 символ <:> , которого там быть не должно. Замените его на символ <;>

c := a+b   ~~~~~~ Еще одна ошибка по поводу символа <:> перед присваиванием. Уберите этот символ.

print(c)

Код 3

a=int (input())

k=3⋅(a+b)-4ab  ~~~~ Переменной <b> не существует, и в самом присваивании присутствует склеенная Цифра с Переменной которой даже не существует, да и склеивать так нельзя. (И еще я так полагаю, что символ <⋅> нужно заменить на <*>

t= a⋅b   ~~~~ полагаю, что символ <⋅> нужно заменить на <*>

print (k) ; print (t)

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Code 1:

```python a = int inpit() b = int intut() t = A + B print(c) ```

There are several errors in Code 1:

1. The `int` function is misspelled as `inpit`. It should be `int(input())` to convert the user input to an integer. 2. The variable `B` is not defined. It should be `b` to match the variable assignment. 3. The variable `c` is not defined before printing. It should be `print(t)` to print the value of `t`.

Here's the corrected version of Code 1: ```python a = int(input()) b = int(input()) t = a + b print(t) ```

Code 2:

```python a = 8 b = 118 c := a + b print(c) ```

There is an error in Code 2:

1. The walrus operator `:=` is not supported in Python versions prior to Python 3.8. If you are using an older version of Python, you need to assign the value of `a + b` to `c` using the traditional assignment operator `=`.

Here's the corrected version of Code 2: ```python a = 8 b = 118 c = a + b print(c) ```

Code 3:

```python a = int(input()) k = 3⋅(a + b) - 4ab t = a⋅b print(k) print(t) ```

There are several errors in Code 3:

1. The multiplication operator `*` is missing in the expression `3⋅(a + b)`. It should be `3 * (a + b)`. 2. The multiplication operator `*` is missing in the expression `4ab`. It should be `4 * a * b`. 3. The multiplication operator `*` is missing in the expression `a⋅b`. It should be `a * b`. 4. There is a semicolon `;` between the two print statements. In Python, statements are usually separated by newlines or by using the semicolon `;`, but it is not necessary in this case.

Here's the corrected version of Code 3: ```python a = int(input()) k = 3 * (a + b) - 4 * a * b t = a * b print(k) print(t) ```

Please note that the variables `b` and `c` are not defined in Code 3. You may need to assign values to them before using them in the calculations.

0 0

Похожие вопросы

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос