Notes with coded examples
monkey notes
- Variable
- Assign Values and input
- Appending and editing into a list
- Sequencing
- iteration
- selection
- Array selection and iteration
- All combined
- Booleans
- Logical operators
- Evaluating
- Condtionals
- Level one challenge
- level 2 challenge
- Nested Statement
- flow chart code
- evaluate
name = "amay"
age = "16"
print(name + " is " + age)
num1=input("Input a number. ")
num2=input("Input a number. ")
num3=input("Input a number. ")
add=input("How much would you like to add? ")
# Add code in the space below
numlist = [int(num1), int(num2), int(num3)]
# The following is the code that adds the inputted addend to the other numbers. It is hidden from the user.
for i in range(len(numlist)):
numlist[i-1] += int(add)
print(numlist)
food1 = "pizza"
food2 = "hot dog"
food3 = "sushi"
food4 = "strawberry"
food5 = "sandwich"
print(food1, food2, food3, food4, food5)
foods = ["pizza", "hot dog", "sushi", 'strawberry', 'sandwich']
print(foods)
for i in range(10, 0, -1):
print(i)
text = "Hi my name is Amay"
for char in text:
if char == "a" or char == "e" or char == "i" or char == "o" or char == "u" or char == "A":
print(char)
for i in range(10, 0, -1):
print(i)
array = [3,16,29,42,55,68,81]
x = 0
a = 0
while x < len(array):
print(array[a])
a+=1
x+=1
nums = [10, 15, 20, 25, 30, 35]
num1 = nums[0]
for x in nums :
if x < num1:
num1 = x
print("The minimum number in the array is " + str(num1))
isRunning = False
result = not isRunning
print(result)
age = 16
if age > 12 and age < 20:
print("You are a Teenager")
teams = 1
score = 2
if teams < 2 or score > 4:
print("Your team won!")
num = list(input("Input a binary number: "))
x = 0
for i in range(len(num)):
digit = num.pop()
if digit == '1':
x = x + pow(2, i)
print("The decimal value of the number is", x)
text = "Hi my name is Amay"
for char in text:
if char == "a" or char == "e" or char == "i" or char == "o" or char == "u" or char == "A":
print(char)
#if text == a or text == e or text == i or text == o or text == u
array = []
array.append("Amay")
array.append("Safin")
if len(array) == 0:
print("No one likes it")
else:
print(" and ".join(array) + " liked it")
isRaining = True
temp = 40
if (isRaining):
if temp < 45 :
print("Wear multiple layers.")
else:
print("Wear whatever you want bruh")
else:
print("What is the weather like?")
isRaining = True
temp = 70
if (isRaining):
if temp < 45:
print("Wear multiple layers.")
else:
print("Wear whatever you want bruh")
else:
if isRaining == False:
print("is it sunny or snowing?")
else:
print("what is the weather like?")
bruh = input("Do you like stem?")
bruhh = input("Do you like science?")
if bruh == "Yes":
if bruhh == "Yes":
print("You would like classes like AP Bio and AP Chem.")
else:
print("You could take english for better results.")
else :
print("You might be better off taking classes like ")