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

Answers

Answer 1

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 2

A loop that will output only the names that come before "Thor" in the alphabet from the names list is written below:

What is a loop?

A loop is a set of instructions in computer programming languages that repeatedly repeats itself until a given condition is met.

The time it takes to determine the number of times the loop iterates before the loop executes is the difference between the decorative and extensive program loops.

If a loop's block of code is to be repeated until the provided condition turns false, and this condition is tested before the block is run, the loop is said to be a pretest.

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

names.sort()

for x in names:

  if x == "Thor":

      break

  else:

      print(x)

Therefore, the loop is written or coded above.

To learn more about the loop, refer to the link:

https://brainly.com/question/25955539

#SPJ2


Related Questions

Other Questions
Just wanna check my answer What is the solution to the equation? sqrtx + 3 = 12 HINT: It's not C.A. 225B. 81C. 3D. No solution What is the formula for finding slope Why should men care about feminism? AMen make up a majority of the population.BMen are also negatively impacted by gender stereotypes.Men should be aware of their privilege.DMen can cause greater change than women. If you have an array of 100 sorted elements, and you search for a value that does not exist in the array using a binary search, approximately how many comparisons will have to be done?a)7b)100c)50 A golf ball of mass m is hit by a golf club so that the ball leaves the tee with speed v. The club is in contact with the ball for time T. The average force of the club on the ball during the time T is: Which posed the greatest challenge to pioneers crossing the western mountains?A. overpopulated rest areasB. lack of waterC. hot desert sandD. steep and dangerous passes What is the natural source of energy in Mars, please help Puede alguien que sea bueno en fsica ayudarme, aqu est el enlace a mi pregunta?can someone who's good at physics please help me here's the link to my questionhttps://brainly.com/question/20730139 11/(x+9)=5I am struggling with this question. Is there a solution? how was the formation of constituent assembly different than the the commission formed for drafting previous constitution in Nepal A farmer notes that in a field full of horses and geese there are 36 heads and 106 feet. How many of each animal are there? ILL MARK AS BRAINLESS PLS HELP A printer can print 12 pages in 9 seconds. what is the closest estimate of the number of pages it can print in one minute?a.100b.45c.120d.72 What effect does noise have on different types of signals?A. It distorts digital signals, making them unreliable.B. It distorts analog signals, making them unreliable.C. Noise has no effect on either analog or digital signals.D. Noise prevents the transmission of both analog and digitalsignals. Perrette Motor Company rebuilds automobile engines that have been damaged or are in need of extensive repair. The rebuilt engine has a 100,000-mile warranty and is purchased by auto shops, large motor pools in companies and governmental units, and some individual auto owners. The plant at Dayton, Ohio, specializes in the Ford V6 engine. Approximately 630 to 830 engines are rebuilt each month, and the costs of the plant are assigned to monthly production using weighted-average process costing. The current month began with a work-in-process inventory of 120 engines which were 50% complete for materials and 50% complete for conversion costs. The materials cost in beginning work-in-process was $68,000, while the conversion cost was $73,200. A total of 530 engines were completed and shipped out during the month, and total materials cost of $636,000 and conversion cost of $731,400 were incurred during the month. The ending work-in-process of 220 units was 50% complete for materials and 30% complete for conversion costs.Required:Compute the cost per equivalent unit for materials and conversion for the month.material cost per equivalent unit:conversion cost per equivalent unit; Help on both questions plz Persepolis is __________________ by Marjane Satrapi.paintingan installationgraphic novelplay P.E. 9th grade Physical Activity and FlexibilityUse information learned from the video to complete the following questions.Explain the principles of overload and progression regarding your flexibility? (1 point)Fill in the following chart (7 points)Type of StretchingAction (how do you perform this stretch)Benefit (what is the benefit to perfoming this stretch)Static StretchingPassive StretchingDynamic StretchingBallistic StretchingActive Isolated StretchingIsometric StretchingP.N.F StretchingWhich one of the above types of stretching do you feel work the best for you and why? (2 points)Why is giving yourself up to 24-48 hours between exercise important to your overall health? (1 point) Choose a sport explain how specific flexibility helps one get ready for participation in that sport. (2 points)Choose two of the three Flexibility assessments from the lecture and explain how they assess your flexibility. (2 points) The historical era referred to as westward expansion is most characterized by (select all that apply) A. fighting of a civil warB. growing urbanizationC. changing settlement patternsD. increasing need for social reform