while loop != 'done'

CHAN SEK KONG 0 Reputation points
2024-08-27T10:29:56.0433333+00:00

Run this cell and provide a list of planets

new_planet = ''

planets = []

while new_planet.lower() != 'done':

if new_planet :                                                    # Checks if the user has entered a value

    planets.append(new_planet)                           # Add a value to the planets list              

new_planet = input('Enter a new planet or done if done') # We ask the user to enter a value
```print ('List of planets entered')

for planet in planets:

print(new_planet)

Please Note

run on Juypter Notebook

nothing happen

please assist.  Thank you.

   

# 


 This question is related to the following [Learning Module](https://learn.microsoft.com/en-us/training/modules/python-loops/5-exercise-for-loops)
Viva Learning
Viva Learning
A Microsoft Viva module that provides employees with formal and informal learning.
102 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CHAN SEK KONG 0 Reputation points
    2024-08-27T13:16:57.39+00:00

    if new_planet:

    and

    new_planet = input('Enter a new planet (lower case) or done if done\n')

    on same identation

    its able to print "Hello"

    however, nothing happen. Please assist. Thank you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.