Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python - Common Conditional Statements

#if, elseif, else
if (myNumber == 5):
    print "My Number is Five";
elif (myNumber == 3.14):
    print "My Number is Pi";
else:
    print "My Number is neither Five nor Pi 
";

 

#while loop
while (myNumber != 0):
    print "My Number is: ", myNumber;
    myNumber -= 1;
print "
";

#for loop
for myNumber in range (0, 5):
    print "My Number is: ", myNumber;
print "
";

#foreach loop
for currentElement in myList:
    print "The current element is: ", currentElement;
Comment

PREVIOUS NEXT
Code Example
Python :: how to reassign a key py 
Python :: msg to pdf converter using python 
Python :: python file operation 
Python :: python extract extension 
Python :: python using boolean len comparing with 
Python :: Matrix Transpose using Nested List Comprehension 
Python :: how to use kite python 
Python :: python get screen dpi 
Python :: prefix in python 
Python :: how do i re-restablish the third reich 
Python :: 90/360 
Python :: reddit python 3 time a python program 
Python :: python bill 
Python :: readline python sin avanzar de linea 
Python :: python selenium firefox handle ssl bypass 
Python :: i want to get only first record of each user in pandas 
Python :: save gif python 
Python :: how to use print statement in python 
Python :: tf.data.Dataset select files with labels filter 
Python :: xml to sqlite 
Python :: python pass statement 
Python :: defining a class in python 
Python :: change the Values to Numpy Array 
Python :: pyspark percentage missing values 
Python :: how to change the title of the top bar in python 
Python :: ploting to data on the same axis 
Python :: Preprocessing of transfer learning inception v3 
Python :: if you have a list and the user input one of the keys then output its value 
Python :: type hinting with default value python 
Python :: python concurrent.futures.ProcessPoolExecutor multiple arguments 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =