Skip to content
← Back to Community
4.1 Code Practice
Profile icon
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
Profile icon
JulianVaquero
Profile icon
RileyShan
Profile icon
kelviman1078
Profile icon
JenniferMusa
Comments
hotnewtop
Profile icon
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.

Profile icon
JenniferMusa

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

Profile icon
Vandesm14

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

Profile icon
JenniferMusa

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

Profile icon
Vandesm14

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

Profile icon
JenniferMusa

@Vandesm14

image

Profile icon
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.

Profile icon
JenniferMusa

@Vandesm14 i got it

Profile icon
Vandesm14

@JenniferMusa

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

Profile icon
JenniferMusa