Python question

Asked 2 years ago, Updated 2 years ago, 19 views

numbers =[ ]

for n in range(5):

    data=int(input('append(data):'))

        numbers.append(data)
print(numbers)

I made the code like this

 Makefile:6: recipe for target 'py3_run' failed

make: *** [py3_run] Error 1

  File "Main.out", line 5

    numbers.append(data):
                        ^
TabError: inconsistent use of tabs and spaces in indentation

an error appears;; what's the problem?

python

2022-09-22 18:26

2 Answers

This is not a Python problem, but an English reading problem.

TabError: / inconsistent use of tabs and spaces / in indentation

Tab error: / Inconsistent tab and space usage / In indent


2022-09-22 18:26

Indentation error! Python is very sensitive to dictation, instead of having no concept of braces in other languages. Incorrect indentations result in unintended errors, such as incorrect use of braces in other languages.

Please modify the code as follows:

numbers =[ ]

for n in range(5):
    data = int(input('append(data):'))
    numbers.append(data)

print(numbers)


2022-09-22 18:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.