Open NeonMist27 opened 1 month ago
POPCORN HACK 3.8.1: nums = []
num_of_inputs = int(input("How many numbers do you want to add to the list? "))
for _ in range(num_of_inputs): number = int(input("Enter a number: ")) nums.append(number)
print("Numbers divisible by 2:") for num in nums: if num % 2 == 0: # Check divisibility by 2 print(num)
HACKS: 3.8.6 HOMEWORK HACK:
numbers = [1, 2, 3, 4, 5]
for number in numbers: print(number) 3.8.8 HOMEWORK HACK:
for number in numbers: if number == 3: continue if number == 5: break print(number)
POPCORN HACK 3.8.1: nums = []
num_of_inputs = int(input("How many numbers do you want to add to the list? "))
for _ in range(num_of_inputs): number = int(input("Enter a number: ")) nums.append(number)
print("Numbers divisible by 2:") for num in nums: if num % 2 == 0: # Check divisibility by 2 print(num)
HACKS: 3.8.6 HOMEWORK HACK:
numbers = [1, 2, 3, 4, 5]
for number in numbers: print(number) 3.8.8 HOMEWORK HACK:
numbers = [1, 2, 3, 4, 5]
for number in numbers: if number == 3: continue
if number == 5: break print(number)