I can't solve one of the training issues.
(Problem) Define a function double (x) that returns a value that is doubled when an integer argument x is given as an argument.
File "main.py", line 4
print double (x)
SyntaxError: invalid syntax
def double (x):
x = input ('Enter value:')
return x * 2
print double (x)
I don't know where to put the input, and I put it above or behind, but I get an error.Supplementary information (FW/tool version, etc.)
Please provide more detailed information here.
Answer # 1
"Print double (x)" SyntaxError: invalid syntax
Is presumed to be the environment of python 3.
print (double (x))
Please enclose the print target with "()".
def double (x): # ter305932 return x * 2 i = input ('Enter value:') print (double (int (i)))
- about errors in python input
- i want to combine lists with python
- python - how to accept number input even if keypressevent is defined for qlineedit in pyside
- how to add python built-in class method
- python - i'm using selenium the text sent by send_keys to the input tag disappears when the text is sent by send_key to the next
- python sarimax how to input exogenous variables (error check request)
- (python) i would like to know how to combine an int value and a multidimensional array
- i want to create a function in python that all functions without class go through
- i was given a python 3 assignment as a cram school assignment, but i don't understand "functions and comprehensions, while
- python - i want to write light text in the input box
- python - valueerror: error when checking input: expected input_1 to have 4 dimensions,
- python - i want to prevent continuous execution of functions
- python - about input error
- i want to input an element and extract one element using the python3 library openpyxl
- numpy - [python] i want to combine alternately and make two sets of two arrays of latitude and longitude
- python - input data format when implementing multivariate lstm by keras
- (python) input () if time elapses without input, skip input () and move to the next process what can i do?
- python - i want to combine two dfs
- python - spyder doesn't recognize functions in my module
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory