Sep-09-2019, 06:27 PM
(This post was last modified: Sep-09-2019, 06:31 PM by YoungGrassHopper.)
Hey guys, I am very new to coding so please bare with me. I am busy with a python bootcamp trying to learn as much as quick as I can. I am currently busy with loops, while loops in particular. What I need to make the program do:
ask a user via input command to enter all student names and once he enters "Stop" the loop of asking him/her to enter the next name must stop. I think I have that part sorted. The next part is my struggle:
After the user enters: "Stop" :
The names of the students needs to be printed out, without the "Stop" being printed as that is obviously not a students name.
My attempt at coding the above looks like this:
I would deeply appreciate some assistance.
Thanks in advance.
The YoungGrassHopper
ask a user via input command to enter all student names and once he enters "Stop" the loop of asking him/her to enter the next name must stop. I think I have that part sorted. The next part is my struggle:
After the user enters: "Stop" :
The names of the students needs to be printed out, without the "Stop" being printed as that is obviously not a students name.
My attempt at coding the above looks like this:
names = input("Enter student name: ") while names != "Stop": names = input("Enter student name: ") if names == "Stop": print(names)So the result I am getting is the phrase "Stop" being printed instead of the student names entered prior to "Stop"
I would deeply appreciate some assistance.
Thanks in advance.
The YoungGrassHopper