Vocabulary

  • greater than: >
  • less than: <
  • greater than or equal to: >=
  • less than or equal to: <=
  • equal to: ==
  • not equal to: !=

Notes

  • boolean operators produce booleans after it is used between 2 values
  • relational operators work between any two values of the same type
  • they are known as operands
  • they can work on strings, lists, and other data types
  • logical operators work on operands to produce boolean results.
  • we can use them in any order as long as the computer recognizes it.

Homework/Hacks

our homework we have decided for a decimal number to binary converter. You must use conditional statements within your code and have a input box for where the decimal number will go. This will give you a 2.7 out of 3 and you may add anything else to the code to get above a 2.7.

def BinaryConvert(number):
## recursive code 
    if number >= 1: 
        BinaryConvert(number // 2) ##based on the power of 2, it will shift the 0 or 1 right
    print(number % 2, end = '') ## the end function prevents it from printing a new line --> binary output is only one line.

    # Driver Code
number = 31
BinaryConvert(number)
011111