Difference between revisions of "Comparison operators assignment"

From WLCS
Line 11: Line 11:
 
'''Exercises:'''
 
'''Exercises:'''
 
* Evaluate the following comparisons as True or False
 
* Evaluate the following comparisons as True or False
Assume x = 2 and y = 4
+
* Assume x = 6 and y = 4
 
# x > 2
 
# x > 2
 
# y <= x
 
# y <= x
Assume x = 5 and y = 1
 
 
# x == 2
 
# x == 2
 
# y != x
 
# y != x
 
+
# x + 2 > y * 2
 +
# y * x < x * y
 +
# x + x >= y * y
 +
# 2*(x-10) < 0
 +
# y - 4 == x - 6
 +
# x / y > y / x
  
 
'''Submit:'''
 
'''Submit:'''
 
* Submit the file to [http://wlhs.schoolweblockers.com/ School Web Lockers]
 
* Submit the file to [http://wlhs.schoolweblockers.com/ School Web Lockers]

Revision as of 12:18, 20 October 2010

Directions:

  1. Open a text editor (Applications->Accessories->gEdit Text Editor)
  2. Put your name at the top
  3. Save the file as YOURLASTNAME_comparison.txt
  4. Complete the exercises below in this file. If you use DrPython, then be sure to copy your code back into this file
  5. Be sure to number each of your answers!!

References:

Exercises:

  • Evaluate the following comparisons as True or False
  • Assume x = 6 and y = 4
  1. x > 2
  2. y <= x
  3. x == 2
  4. y != x
  5. x + 2 > y * 2
  6. y * x < x * y
  7. x + x >= y * y
  8. 2*(x-10) < 0
  9. y - 4 == x - 6
  10. x / y > y / x

Submit: