Vocab

Function Symbol
greater than >
less than <
greater than or equal to >=
less than or equal to <=
equal to ==
not equal to !=

Key Terms

  • Boolean expression:TRUE or FALSE statement- Conditional: Handles conditions in your program
  • Nested conditional: if or if else statement inside a different if else statement.
  • Algorithm: A set of instructions that accomplish a task.
  • Selection: The process that determines which parts of an algorithm is being executed based on a condition that is true or false.

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.

Below is an example of decimal number to binary converter which you can use as a starting template.

def DecimalToBinary(num):
    if num > 0:
        DecimalToBinary(num // 2)
    print(num % 2, end = "")

num = int(input("choose your number"))
print("The number: ", num, " converts to ", end = "")
DecimalToBinary(num)
The number:  12  converts to 01100