aa = [1,4,6,8,9] for x in aa: print (x) print (aa)
The above program displayed all the contents of the list.
Judge whether the value extracted as the processing of the for statement is an even number or not by the if statement
I want to rewrite it so that it is displayed only when it is an even number.
aa = [1,4,6,8,9] for x in aa: print (x) if x% 2 == 0: pass print () else: else: pass print ()
I understand that even numbers can be represented by using the remainder, but I don't know how to write them. We look forward to hearing from you.
Answer # 1
The indentation is strange in the code presented.
That if statement must be inside a for loop
Let's do something about it.
- python - repeated statement using pyjnius
- i don't understand the exercises using python trigonometric functions
- python 3x - how to rename a folder created using jupyternotebook
- python - image recognition using cnn keras multiple inputs
- python 3x - valueerror: not enough values to unpack (expected 3, got 2)
- i want to retrieve the elements in the middle of the difference sequence as a list python
- python 3x - i want to get a matrix with the values of a certain column removed for each row of the matrix with pytorch (speedu
- about batch change of file name using python
- python - read and write values from another file
- python - i want to remove whitespace in dictionary values
- python - is it possible to bring the values of the list in params from the fixture when parameterizing the fixture with pytest
- python 3x - i want to get the nth array with an argument using python3 argparse
- how to make a loop statement in 1 second increments with python
- python for statement conversion how to use the line below
- assign values to array arguments using variables
- about external libraries when using multiple versions of python
- python: of the results obtained by the for statement, i want to make an empty array like  into [''']
- python 3x - processing to jump to the link destination using chrome driver in python
- python - error in image binarization using cv2adaptivethreshold function
- python 3x - about functions used in python for statement