Flashield's Blog

Just For My Daily Diary

Flashield's Blog

Just For My Daily Diary

Day: January 24, 2024

05.exercise-loops-and-list-comprehensions【练习:循环及列表推导式】

This notebook is an exercise in the Python course. You can reference the tutorial at this link. Try It Yourself With all you’ve learned, you can start writing much more interesting programs. See if you can solve the problems below. As always, run the setup code below before working on the questions. 自己尝试一下 有了所学的知识,您就可以开始编写更有趣的程序了。 看看你能否解决下面的问题。 […]

05.course-loops-and-list-comprehensions【循环及列表推导式】

Loops Loops are a way to repeatedly execute some code. Here’s an example: 循环 循环是重复执行某些代码的一种方式。 这是一个例子: planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune'] for planet in planets: print(planet, end=' ') # print all on same line Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune The for loop specifies the variable name to […]

Scroll to top