IT 116: Introduction to Scripting
Answers to Class 7 Ungraded Quiz

  1. Write an if statement that prints "Too big" if the value of the variable number is greater than 100.
    if number > 100:
    	print("Too big")
  2. What are the only values that a boolean expression can have?
    True and False
  3. Write the Python boolean literals.
    True and False
  4. Write the boolean expression that is true if the value of the variable number_1 is greater than or equal to value of the variable number_2.
    number_1 >= number_2
  5. Write an if statement that prints "Too big" if the value of the variable numb is greater than 1000.
    if numb > 1000:
    	print("Too big")
  6. Write an if/else statement that prints "Positive" if the value of the variable numb is greater than or equal to 0, and prints "Negative" if it is not.
    if numb >= 0:
         print("Positive")
    else:
    	 print("Negative")
  7. Write an if/elif/else statement that prints "Positive" if the value of the variable numb is greater than 0, and prints "Negative" if it is less than 0 and print "Zero" otherwise.
    if numb > 0:
        print("Positive")
    elif numb < 0:
        print("Negative")
    else:
    	print("Zero")
  8. If you typed the following in the Python interactive mode, what would the result be?
    "foo" < "bar"
    False
  9. If you typed the following in the Python interactive mode, what would the result be?
    "sam" == "Sam"
    False
  10. If you typed the following in the Python interactive mode, what would the result be?
    5 != 6
    True