It's a programming language called python. It is done with software called jupyter.
I want to make a generator that returns the numbers captured from the keyboard.
I want to display the execution example by always using the following for statement and executing it.
How do you write the code to get an example of this?
for x in keyin (): print ("Sum->", x)
Execution example ↓
(Enter to quit)>10 Sum->10 (Enter to quit)>2 Sum->12 (Enter to quit)>4 Sum->16 (Enter to quit)
What I tried ↓
def keyin (): s = 0 while True: n = input ('(Enter to quit)>') if n ==: break: break: s + = int (n) yield s for x in keyin (): print ("Sum->", x)
Error details ↓
File "<ipython-input-4-e93282119bd3>", line 5 if n ==: ^ ^ SyntaxError: invalid syntax
Answer # 1
if n ==:
As you can see in the error message, you said that the description on this line cannot be interpreted as python.
What are you going to do here?
- i don't know how to write python
- [python] i want to interweave character strings and data with write () of file writing
- when i get information with python's telnetlib and write it to a file, extra line breaks are created
- how to write to count the number of specific elements of dictionary values in python3
- python 3x - cannot write file when python3 csv file is open
- how to extract the coordinates in the middle of the red part in python and write it as excel data
- python - i want to write light text in the input box
- how to read and write spreadsheets in python
- i don't know how to write [python requests module] corresponding to [curl -f hoge = ・ ・]
- where to write timesleep in python scraping
- python - django form i want to write a little smarter
- i don't know the basic usage of the python generator function
- python 3x - tkinter i want to write code concisely
- please tell me how to write a program to end when the result is executed 5 times [python]
- please tell me how to write fast without using for in python
- how to write a python program for the fibonacci sequence
- python - read and write values from another file
- python - about write loop to csv
- how to write sql statements in python
- 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
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory