Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

for_loops

# for loops
x = [ 0 for i in range(10)]
print(x) 			 # 0,0,0,0,0,0,0,0,0,0
y = [ i for i in range(10) if i%2 == 0]
print(y)			                # 0,2,4,6,8
z = [ i*j for i in range(3) for j in range(3)]
print(z)			                # 0,0,0,0,1,2,0,2,4
k = [[0 for _ in range(3)] for _ in range(3)] 
print(k)			               # [0,0,0],[0,0,0],[0,0,0]
s = [ i for i in 'hello']
print(list(s)) 			# ['h','e','l','l','o']
print(tuple(s))			# ('h','e','l','l','o')

Comment

PREVIOUS NEXT
Code Example
Python :: reolace text python 
Python :: python pause command 
Python :: ENUM AS STRING GODOT 
Python :: java scirpt 
Python :: compute difference in dates after groupby 
Python :: how to click the next button on a website using python 
Python :: apk calculate python 
Python :: group by month and year 
Python :: # generators 
Python :: Python find permutations of operators between each digit in a given string of digits will result in a particular answer 
Python :: pairplot markersize 
Python :: pairplot lower triangular 
Python :: FizzBuzz in Python Using String Concatenation 
Python :: pyttsx3 listen to events 
Python :: looping emails using a database with python code 
Python :: Command to install Voluptuous Python Library 
Python :: Math Module acos() Function in python 
Python :: for i in range(6, 11): print(i, end="") 
Python :: how to find the index of a specific number in pythong? 
Python :: python convert dataframe target to numbers 
Python :: drop columns delta table 
Python :: python subprocess call with no environment variable 
Python :: Python NumPy moveaxis function Example 
Python :: find duplicate row in python sqlite database 
Python :: Python NumPy block Function Syntax 
Python :: How can I Duplicate 1 Dimensional array 
Python :: Python how to use __sub__ 
Python :: calculate mse loss python 
Python :: URL to origin python 
Python :: enumerate and looping backward 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =