Uploaded by Kweki Kwek Bellote

SIOMAI

advertisement
SCENARIO 1
squares = 16
ctr= squares - 1
for i in range(squares):
if ctr!=squares:
x = 2**i
print("2 to the power of",i,"is",(x))
i = i - 1
SCENARIO 2
secret_num = 24
userNumber= int(input("Enter an integer num: "))
while userNumber!= secret_num:
print("Ha ha! You're stuck in my loop!")
userNumber= int(input("Enter an integer num: "))
if userNumber== secret_num:
print("Well done, muggle! You are free now.")
SCENARIO 3
user_word = input("Enter a word: ")
user_word = user_word.upper()
for char in user_word:
# Complete the body of the for loop.
if char == "A":
continue
elif char == "E":
continue
elif char == "I":
continue
elif char == "O":
continue
elif char == "U":
continue
else: print(char, end='\n') or print(char)
SCENARIO 4
print(float(0b1))
print(float(0b10))
print(float(0b11))
print(float(0b100))
print(float(0b101))
print(float(0b110))
print(float(0b111)) print(float(0b1000))
print(float(0b1001))
print(float(0b1010))
print(float(0b1011))
print(float(0b1100))
print(float(0b1101))
print(float(0b1110))
print(float(0b1111))
print(float(0b10000))
print(float(0b10001))
print(float(0b10010))
print(float(0b10011))
print(float(0b10100))
SCENARIO 5
my_list = [1,2,4,4,1,2,6,2,9]
uniqueNew_list=[]
#Browse the test data (in numbers) from the given list.
#Using for loop function and "appending the numbers" to formulate the output.
for numbers in my_list:
if numbers not in uniqueNew_list:
uniqueNew_list.append(numbers)
#Use the equation below to completely run and see the desired output, which is appearing the numbers from the source list not in a repetitive way. my_list = uniqueNew_list[:]
print("The list with unique elements only:")
print(my_list)
Download