Notes

-Boolean operators produce booleans after a comaprison
-relational operators work between two values of same type(operands)
-AND: true true
-OR: true false/ false true
-NOT: false
-algorithm: set of instructions that accomplish a task
-selection: proccess determining what to do based on a condition
-if/else statements are selction
-nested conditionals: condtion in condition

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 convert(dec):
    bin = ""
    i = 100

    while i >= 0:
        if int(dec) % (2**i) == dec:
            bin = bin + "0"
            i -= 1
        else:
            bin = bin + "1"
            dec -= 2**i
            i -= 1
    j = 0
    while int(bin[j]) == 0:
        j += 1
    bin = bin[j:len(bin)]

    print(bin)

var = int(input("Choose a number to convert: "))
convert(var)
1000101