Ask coding questions

← Back to all posts
4.1 Code Practice
JenniferMusa

Write a program that asks the user to enter a name, and then print "Nice to meet you NAME". Your program should repeat these steps until the user inputs "Nope".
Sample run:

Please enter a name: (Nope to end) Antonio
Nice to meet you Antonio
Please enter a name: (Nope to end) Jonathan
Nice to meet you Jonathan
Please enter a name: (Nope to end) Tyler
Nice to meet you Tyler
Please enter a name: (Nope to end) Brianne
Nice to meet you Brianne
Please enter a name: (Nope to end) Nope

Voters
JulianVaquero
RileyShan
kelviman1078
JenniferMusa
Comments
hotnewtop
Vandesm14

Can you provide your code?

Keep in mind that we cannot give you the answer, so posting multiple assignments and asking us to complete them for you is not going to work. Please try the assignment first and then share your issue and provide your code.

JenniferMusa

@Vandesm14 I tried them but just could not find the answer

Vandesm14

@JenniferMusa Can you provide your code in a repl? I cannot just give you the answer. You need to try it yourself first.

JenniferMusa

@Vandesm14 here it is
w = input("Enter a name(NOPE to the end"))
while (w!= "NOPE"):
print("Nice to meet you" + w)

Vandesm14

@JenniferMusa Well, does your code work? What is the issue you're facing (if any)?

JenniferMusa
Vandesm14

@JenniferMusa You need to indent the code you want inside the while loop. Python does not use brackets: instead, it uses indentation to figure out which code is in which block.

JenniferMusa

@Vandesm14 i got it

Vandesm14

@JenniferMusa

Please mark my comment as the answer if I resolved your issue 👍

JenniferMusa