EMT 1111 Labs

Lab 0

Lab Description

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis malesuada, dui feugiat ultricies pretium, metus quam lacinia dui, dignissim tincidunt ligula urna ac nulla. Aliquam erat volutpat. Maecenas nec dui nec nibh lacinia fermentum non id elit. Maecenas non quam quam. Duis vel lorem enim. Nam facilisis ultrices lectus, sed fringilla dui hendrerit pretium. Suspendisse faucibus mollis lorem. Vivamus egestas ipsum vitae mauris fringilla vulputate. Duis ultricies tellus eros, porttitor accumsan enim. Mauris eu mauris nibh, vel porttitor neque. Etiam auctor neque ut diam ultricies sit amet venenatis purus convallis. Aliquam id nulla velit, eu mattis urna. Curabitur ipsum ante, tristique vitae vehicula a, porta a urna. Curabitur placerat sapien eu lacus sagittis accumsan.

Code

>>> x=5
>>> y=3
>>> x+8+y-2
14

Screenshot

Lab 1

Lab Description

This Lab consisted of a series of exercises designed to familiarize our selves with the use of variables as well as setting the values of specific variables and words.

Code1 (Exercise 2)

>>> 5
5
>>> x=5
>>> x+1
6

Screenshot 1

Code 2 (Exercise 3) 

>>> width = 17
>>> height = 12.0
>>> delimiter = ‘.’
>>> width/2
8
>>> width/2.0
8.5
>>> height/3
4.0
>>> 1+2*5
11
>>> delimiter*5
‘…..’

Screenshot 2

Lab 2

Lab Description

The program asks for two integers. Then the user is given the sum, the difference, the product and the quotient of the two integers. After the user is told whether the integers are greater than or less than the other, or if they are the same. 

Code

# This is a comment
# First Script

a_str = input(“please enter a number: “)
b_str = input(“please enter a second number: “)

a = int(a_str)
b = int(b_str)

#Processing Stage

if a==0:
print(“Program End”)

elif b==0:
print(“Program End”)

else:
my_sum = a+b
my_difference = a-b
my_product = a*b
my_quotient = a/b

#Output Stage

print(‘The sum of both numbers are:’,my_sum)

print(‘The difference of both numbers are:’,my_difference)

print(‘The product of both numbers are:’,my_product)

print(‘The quotient of both numbers are:’,my_quotient)

if a>b:
print(‘The first value is greater than the second value’,my_difference)

elif a<b:
print(‘The second value is greater than the first value’,my_difference)

else:
print(‘Both values are the same’,my_difference)

Screenshot

 Lab 4

Lab Description

1: (Exercise 1, Chapter 8) Write a function that takes a string as an argument and displays the letters backward, one per line.

2: (Exercise 3, Chapter 10)Write a function that takes a list of numbers and returns the cumulative sum; that is, a new list where the ith element is the sum of the first i+1 elements from the original list. For example, the cumulative sum of [1, 2, 3] is [1, 3, 6].

 Code 1 (Exercise 1)

object = ‘watch’
index = 0
while index < len(object):
letter = object[index]
print ‘\n’.join(reversed(‘watch’))
index = index + 1

Screenshot 1 (Exercise 1)

Code 2 (Exercise 3)

 Lab 5

Lab Desciption

The app asks the user to “Pet The Kitty”. When the Kitty is petted a meow sound will play and the phone will vibrate.

Code

Screenshots

Lab 6

Lab Description

The user is asked to select a color.Once they do they can then begin to draw on the cat picture. They can also change the size of the dots. If they want they can take their own pictures and set it as the background image.

Code

Srcreenshot