## Bits: A place value in powers of a number. 1 = true, 0 = false, if it's false, the value isn't taken into consideration if true it is

Binary: 100101
Decimal: 37

## Bytes: 8 bits
10010011

## Hexadecimal: Series of 6 diguts representing a color 
print("#000000")
print("#111111")

# Nibbles: 4 bits 
print("0101")

# Unsigned integer: An integer that  doesn't have an + or - sign

uInt = 6
if uInt >=0:
    print(uInt,": ","This is an unsigned integer")
else:
    print(uInt,": ", "This is not an unsigned integer")

# Signed integer: An integer that has an + or - sign 

uInt = -6
if uInt >=0:
    print(uInt,": ","This is an unsigned integer")
else:
    print(uInt,": ", "This is not an unsigned integer")

# Floating point: Extending binary number to also have fractions or larger numbers 

x = int(10110)
y = int(1101)
Integer = str(x)+"."+str(y)
print(Integer)

# Boolean: An expression that returns either true or false 

print(4>5)

# ASCII: An 8-bit code that uses eight bits to represent a letter or a punctuation mark.

print("a = 1100001")

# Unicode: International encoding for each letter, digit, and symbol each with unique values 

print("A: (U+0041)")

# RGB: A color model where the primary colors of red, green, and blue are mixed together in different ways

print("#000000 = black")
print("#ffffff = white")

# Lossy: Compressing the data in a file by removing some of the data so that it is no longer in its original form after decompression.

print("abcdefg")
print("Compression: abcd")
print("Decompression: abcde")

# Lossless: Restores the file's data to its original form during decompression.

print("abcdefg")
print("Compression: abcd")
print("Decompression: abcdefg")

# Unit 3 Vocab:
## Variables:  an abstract storage location paired with an associated symbolic name
x = 2
## Data Types: Boolean, Lists, Dictionary, and Sequences
x = 0
y = 10
if x > y:
    print("x is greater than y")
else:
    print("x is not greater than y")

fruits = ["apple", "grape", "strawberry"]

capital_city = {"Nepal": "Kathmandu", "Italy": "Rome", "England": "London"}
## Assignment Operators: Used to assign value on right to left while performing the thing next to it

a = 3
b = 5
a &= b

## Lists:an abstract data type that represents a finite number of ordered values, where the same value may occur more than once

fruits = ["apple", "grape", "strawberry"]

## 2D Lists: collection of data cells, all of the same type, which can be given a single name

N = 5
ar = [0]*N
print(ar)

## Dictionaries: an abstract data type that defines an unordered collection of data as a set of key-value pairs

capital_city = {"Nepal": "Kathmandu", "Italy": "Rome", "England": "London"}

## Class: a template definition of the methods and variables in a particular kind of object 

class Person:
    "This is a person class"
    age = 16

    def greet(self):
        print('Hello')

## Algorithms: a procedure used for solving a problem or performing a computation
# step1 = START ADD
# step2 = get values of a & b
# step3 = c ← a + b
# step4 = display c
# step5 = STOP

## Sequence: the first programming construct
cities = ['San Francisco', 'New York', 'Washington DC']
print('New York' in cities)
## Selection:
num = int(input('Enter any number: '))
if (num % 5 == 0):
    print(f'Given number {num} is divisible by 5')
    print('This statement belongs to if statement')
print('This statement does not belongs to if statement')
## Iteration: Repeats a code if condition is true.
list = [1,2,3,4]
for i in list:
    print(i)
## Expressions: A combination of values and functions which creates a new value
x = 1
y = 2
z = 3
sum = x+y+z
print(sum)
## Comparison Operators: Operators used to compare two values.
x = 1
y = 2
if x ==y:
    print("x=y")
else:
    print("y>x")
## Booleans Expressions and Selection: Selecting subsets of data based on their actual values rather than by their row/column.
list = [1,2,3,4,5,6]
for i in list:
    if i == 5:
        print(i)
## Booleans Expressions and Iteration: Looping through a list and filtering out data using booleans.
list = [1,2,3,4,5,6]
for i in list:
    while i>=0:
        print(i)
## Truth Tables: Tables that display the results of logical operators AND, OR, XOR, and NOT using binary 1 and 0.
print("Example: OR")
print("1|0 = ", 1|0)
print("~(1|0) = ", ~(1|0)%2)
## Characters: Letters and punctuation that are created using a specific binary value(ACSII) 
print("a: ", 1100001)
## Strings: A data type involving a sequence of characters.
print("Hello World")
## Length: The number of characters in a string, or values in a list.
list = [1,2,3,4,5,6]
print(len("hello"))
print(len(list))
## Concatenation: Combining multiple strings without leaving spaces in between.
x = "Hello"
y = "World"
msg = x+y
print(msg)
## Upper: Converts a string into all uppercases.
x = "hello world"
print(x.upper())
## Lower: Converts a string into all lowercases.
x = "hello world"
print(x.lower())
## Traversing string: Displays only a part of the original string.
x = "Hello World"
print(x[1:5])
## Python If statement: Executes a segment of code if a certain condition is met.
x = 0
y = 1
if x>-1:
    print("x is not a negative number")
## Python Elif statement: Executes a segment of code if a certain condition is met and after the If statements are false.
x = 1
if x==0:
    print(x)
elif x ==1:
    x+=1
    print(x)
## Python Else statement: Executes a segment of code if all the previous conditions of If and Elif statements are not met.
x = 0
y = 10
if x > y:
    print("x is greater than y")
else:
    print("x is not greater than y")
## Nested selection statements: An if statement inside of an if statement.
x = 0
if x == 0:
    x+=2
    if x ==4:
        print("4 dollars please")
    elif x==2:
        print("2 dollars please")
## Python For loops with range: Iterates through a sequence of numbers.
for i in range(4):
    print(i)
## Python For loops with list: Iterates over a list.
x = [1,2,3,4,5]
for i in x:
    print(i)
## While loops with list: Iterating over a list until it terminates by failing to meet the condition.
list = [1,2,3,4,5,6]
for i in list:
    while i>=0:
        print(i)
## Combining loops with conditionals to break: Exiting a loop using an if statement inside the loop.
x = [1,2,3,4,5]
for i in x:
    print(i)
    if i ==5:
        break
## Python Def procedures: Creating functions that can execute code.
def functionExample():
    print("Hello World")
    
functionExample()
## Parameters: The variables listed inside the parentheses when defining a function.
def variable(n):
    n +=1
    print(n)

variable(2)
## Return values: A value that a function returns to the caller.
def linear_search(lst, x):
    start_time = time.perf_counter_ns() # records time (nanoseconds)
    for i in range(len(lst)): # loops through the entire list 

        if lst[i] == x: # until the x value we are looking for is found
            end_time = time.perf_counter_ns() # records time again
            total_time = (end_time - start_time) // 1000 # subtracts last recorded time and first recorded time
            print("Found element after {} loops in {} microseconds".format(i+1, total_time)) # prints the results
            return print("Your number was found at", i)
            
    end_time = time.perf_counter_ns() # records the time again
    total_time = (end_time - start_time) // 1000 # subtracts last recorded time and first recorded time
    print("Element not found after {} loops in {} microseconds".format(len(lst), total_time)) # prints the results
    return "Your number wasn't found :("