brooklynking1 brooklynking1
  • 21-01-2021
  • Computers and Technology
contestada

A loop that will output only the names that come before "Thor" in the alphabet from the names list.

Respuesta :

Cytokine
Cytokine Cytokine
  • 21-01-2021

names = ["Kevin", "Joe", "Thor", "Adam", "Zoe"]

names.sort()

for x in names:

   if x == "Thor":

       break

   else:

       print(x)

I made up my own names for the sake of testing my code. I wrote my code in python 3.8. I hope this helps.

Answer Link

Otras preguntas

How to factor: n^2-5n+6
Calculate the number of moles 3.16 g of KMnO4 32.33 g of K2CrO4 100 g of KHCO3
How do I solve a quadratic equation like this: x squared minus 9x = -14?
Why did the Great Britain raised taxes in 1763?
Which of the following is not a factor in determining a culture's economic activity? a.climate b.language c.physical landforms d.natural resources
solve allgebraically for x: log base 27 (2x-1)=4/3
Name for the group of adult male citizens who made the laws in Athens
(2y-1)(4y-3) What is the answer to this?
Can someone please help me with these two questions
Please help me When buying a new car, you have a choice of 4 different models, 3 different colors, and either compact or family size. How many choices are ther