Lab 1

Lab Description:

In this lab, were given the following assignment statements:
width = 17
height = 12.0
delimiter = ‘.’
I must write the value of the expression and the type (of the value of the expression), for each of the following expressions.
width/2
width/2.0
height/3
1 + 2 * 5
delimiter * 5
I used the Pythone Interpreter for create a code and checking my answers.
This code perform the few math operations, and shows a different types of values: integer, float and string.

Code:

 
width = 17
height = 12.0
delimiter = '.'

print 'width = 17'
print 'width/2 =', width/2
print 'value =', width/2
print  type (width/2)
print'_ _ _ _ _ _ _ _ _ _ _ _ _ _'
print''
print 'width = 17'
print 'width/2.0 =', width/2.0
print 'value =', width/2.0
print  type (width/2.0)
print'_ _ _ _ _ _ _ _ _ _ _ _ _ _'
print''
print 'height/3'
print 'height/3 =', height/3
print 'value =', height/3
print  type (height/3 )
print'_ _ _ _ _ _ _ _ _ _ _ _ _ _'
print''
print '1 + 2 * 5'
print '1 + 2 * 5 =', 1 + 2 * 5
print 'value =',(1 + 2 * 5)
print  type (1 + 2 * 5 )
print'_ _ _ _ _ _ _ _ _ _ _ _ _ _'
print''
print "delimiter = '.'"
print 'delimiter * 5 =', delimiter * 5
print 'value =', delimiter * 5
print  type (delimiter * 5 )

lab1

 

Screenshots:

 

lab1a

 

Leave a Reply

Your email address will not be published. Required fields are marked *