Take me to pcigeomatics.com

PCI Geomatics Help Center

How can we help you today?

Conditional Statements and Loops

PCI Geomatics -

'''**********************************************************

	PCI Geomatics(C) - Conditional Statements and Loops
	
**********************************************************'''

print ""
print ""
print "***************************************************************"
print ""
print "       -= PCI Geomatics(C) =-"
print "     Conditional Statements and Loops"
print ""
print "***************************************************************"

# Define Variables

letters = ['a', 'b', 'c', 'd'] 
numbers = [1, 2, 3, 4]
var1 = "Hello"
var2 = "fun"


# This if statement determines whether the input is a string
if type(var1) is str:
	print "Variable one is a string"
	
else:
	print "Variable one is not a string"
	

# This for statement iterates through all values in the list 'letters' 
# and prints out the total number of values within the list	
count = 0
for i in letters:
	count=count+1
	print count
	
	
# This while loop takes all the values from the list 'letters' 
# and appends them to the empty 'list1'
count = 0
list1= []	
while len(list1) < 4:
	list1.append(letters[count])
	count= count+1
print list1

Have more questions? Submit a request

Comments

Powered by Zendesk