Variable

name = "amay"

age = "16"

print(name + " is " + age)

Assign Values and input

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)

Appending and editing into a list

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)

Sequencing

for i in range(10, 0, -1):
   print(i)

iteration

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)

selection

for i in range(10, 0, -1):
   print(i)

Array selection and iteration

array = [3,16,29,42,55,68,81]
x = 0
a = 0
while x < len(array):
   print(array[a])
   a+=1
   x+=1

All combined

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))

Booleans

isRunning = False
result = not isRunning
print(result)

Logical operators

age = 16
if age > 12 and age < 20:
   print("You are a Teenager")

Evaluating

teams = 1
score = 2
if teams < 2 or score > 4:
   print("Your team won!")

Condtionals

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)

Level one challenge

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

level 2 challenge

array = []
array.append("Amay")
array.append("Safin")
if len(array) == 0:
   print("No one likes it")
else:
   print(" and ".join(array) + " liked it")

Nested Statement

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?")

flow chart code

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?")

evaluate

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 ")