AP CSP Unit 3 Sections 3-4 Homework
Homework/Binary Adaptation: Create a python function that will convert a decimal number 1-255 to binary using mathematical operations and powers of 2. Challenge: add frontend with javascript or html.
def convert(number):
if number > 1:
convert(number//2)
print(number%2, end = "")
convert(240)
Homework/List Adaptation: create a function that prints the name of each string in the list and the string's length. Challenge: add frontend with javascript or html.
names = ["jaden","max","dylan","orlando"]
def length(list):
for i in list:
print(i,": ", len(i))
length(names)