Skip to content

Categories:

Tahir Roethof Lab 2

Found this lab easy and hard check out my code, only the last two gave me problems.

#Tahir Roethof
#EMT 1111
#Lab 2 -Control Flow
#2/28/13

import math

print (‘ Operation 1: The sum of x + y’ )
print (‘ y will is equal to 5’ )

y = 5
x = input(‘ Input the value for x:’)

sum = x + y
print (‘ The sum of ‘,x,’ and ‘,y,’ is ‘,sum,)

print (‘————-‘)
print (‘Operation 2: The difference of x – y’)
print (‘This time you will be inputing the values for x and y’)

x = input(‘ Input the value for x:’)
y = input(‘ Input the value for y:’)

difference= y – x

print(‘ The difference of ‘,x,’ and ‘,y,’ is ‘,difference)
print(‘—————‘)
print(‘Operation 3: The product of x and y’)

x = input(‘input the value for x:’)
y = input(‘input the value for y:’)
product=  x * y

print(‘ the product of ‘ ,x, ‘ and ‘ ,y, ‘ is ‘ ,product)

print(‘—————‘)
print(‘Operation 4: The quotient of x/y’)
x = input(‘ input the value for x:’)
y = input(‘ input the value for y:’)
quot = x / y

print(‘ the quotient of ‘,x,’ divided by ‘,y,’ is ‘,quot)

print(‘—————-‘)

print(‘Operation 5: The remainder of x % y’)
x = input(‘ input the value for x:’)
y = input(‘ input the value for y:’)

rem = x % y

print(‘ the remainder of ‘,x,’ and ‘,y,’ is equal to ‘,rem)

print(‘—————-‘)
print(‘ Greater than or less than’)
input(‘ input the value for x:’)
input(‘ input the value for y:’)
if  x >= y:
print(‘ x ‘,x,’ is greater than or less than ‘,y)

Posted in Uncategorized.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.