Lab 1

Lab Description: 
Using python to assign values to variables then evaluating basic expressions to figure out the end result. We also have to find the type of value the result becomes, integer, string, float etc.

We have to assign these values to these variables:

width = 17
height = 12.0
delimiter = ‘.’

Then we have to evaluate these expressions using the assigned variables:

  1. width/2
  2. width/2.0
  3. height/3
  4. 1 + 2 * 5
  5. delimiter * 5

Code:

print("Lab 1")
print("\n")
width = 17
print("width = 17")
height = 12.0
print("height = 12.0")
delimiter = '.'
print("delimiter = '.'")
print("\n")
print("1. width/2:")
print(width/2)
print (type (width/2))
print("\n")
print("2. width/2.0:")
print(width/2.0)
print (type (width/2.0))
print("\n")
print("3. height/3:")
print(height/3)
print (type (height/3))
print("\n")
print("4. 1+2*5:")
print(1+2*5)
print (type (1+2*5))
print("\n")
print("5. delimiter*5:")
print(delimiter*5)
print (type (delimiter*5))
input()

Screenshot:
lab 1

 

Leave a Reply

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