Thanks for your support.
I tried to make the following syntax to globalize some of the variables in a python function.
def misoshiru2 (x): print ("Miso soup \ n") print (str (x) + "Change the amount of salt to the age \ n") global enbun enbun = 1.2/x print ("salt" + str (enbun) + "g. \ n") print ("Melting soup and miso \ n") print ("Pour into the container and complete. \ n") x = int (input ("Please tell me your age. \ n")) misoshiru2 (x) print (enbun)
IndentationError: unindent does not match any outer indentation level
enbun = 1.2/x
The Indent is strange, but if you indent it, it becomes Indent as mentioned above when you copy it, and an error occurs. What kind of device should I devise?
As an execution environment, we use a web application called Repl.it.
By the way, when starting up through python.exe, etc., Indent will probably be complete
Answer # 1
More about it
def misoshiru2 (x): print ("Miso soup \ n") print (str (x) + "Change the amount of salt to the age \ n") global enbun;enbun = 1.2/x print ("salt" + str (enbun) + "g. \ n") print ("Melting soup and miso \ n") print ("Pour into the container and complete. \ n") x = int (input ("Please tell me your age. \ n")) misoshiru2 (x) print (enbun)
Answer # 2
As far as I confirmed here, there seems to be no problem. Is it mixed with TAB characters? (If you post to StackOverflow, it will be converted to a space without permission.)
Answer # 3
How about copying and running the code displayed on this page?
It's running correctly here.
- about variables in python
- about the operation of python's speedtest module (library)
- python - about the place to judge the execution result in the object language
- python - about processing of for statement
- python - about the target method when nothing is returned for the query of table
- about the problem that python fails to determine the exact match of a string
- a command to display all c global variables in gdb
- python - about session management of flask login
- about byte processing clipping in python
- about python
- about local variable references in python
- python - about the difference in behavior between sort and sorted
- about wxpython
- about the cause of syntax error: invalid syntax in python
- about scraping in python
- python - about the problem that the screen display does not work when i have multiple apps in django
- python - about pulp shift scheduling
- python - i want to import the date and time name file by specifying variables
- python - about operation parameters in machine learning production
- how to write a python program for the fibonacci sequence
- i want to create a function that calculates the absolute value in python
- when i define a function in python, the local variable'a' referenced before assignment is output
- python - how to use subscripts to represent the values of another list in a list