Answer:
short_names = ["Gus", "Bob", "Ann"]
print(short_names[0])
print(short_names[1])
print(short_names[2])
Explanation:
There are some typos in your code. In addition to the missing part of the code, I corrected the typos.
First of all, initialize the list called short_names. The list starts with "[" and ends with "]". Between those, there are must be the names (Since each name is a string, they must be written between "" and there must be a semicolon between each name)
Then, you can print each name by writing the name of the list and the index of the names between brackets (Index implies the position of the element and it starts with 0)
Yoooo whattt?? I don’t get this but idek
Answer:
negatives = []
zeros = []
positives = []
while True:
number = input("Enter a number: ")
if number == "":
break
else:
number = int(number)
if number < 0:
negatives.append(number)
elif number == 0:
zeros.append(number)
else:
positives.append(number)
for n in negatives:
print(n)
for z in zeros:
print(z)
for p in positives:
print(p)
Explanation:
Initialize three lists to hold the numbers
Create a while loop that iterates until the user enters a blank line
Inside the loop:
If the number is smaller than 0, put it in the negatives list
If the number is 0, put it in the zeros list
Otherwise, put the number in the negatives list
When the while loop is done, create three for loops to print the numbers inside the lists
Wiki is the correct answer