please someone help! i need to get this done but nobody can help >.>
4.1 Code Practice
Question 1:
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".
Steencs2011:
Hello, in which language are you coding?
Answers
Answered by
2
Let's suppose you are writting a console application in C#.
var flag = true;
var name = "";
while (flag){
Console.Writeline("Please enter your name");
name = Console.Read();
if(name == "NoPe"){
flag = false;
}else{
Console.Writeline("Nice to meet you: " +name);
}
}
Hope it helps!
Answered by
0
Below are the codes in python for the above question:
Explanation:
print("Enter your name") #display the message to enter the name.
Name=input() # takes inputs from the user.
while(Name!='Nope'): # While loop which executes until the person does not enter Nope.
print("Nice to meet you"+Name) # prints the name with the string defined in the question.
print("Enter another name") # render a user instruction to enter another name.
st=input() # take another inputs from the user.
Output:
- If the user inputs "Sohan" for the first input and "Nope" in second input then the program gives output: Nice to meet you Sohan.
Code explanation:
- The above program written in python language which first gives a message to enter your name and then the name will be compared in while loop condition to check that the name is not equal to Nope then the message will print with the name if the string is not Nope but the program will be terminated if the string is Nope.
Learn More:
- Python: brainly.in/question/14689905
- Python : brainly.in/question/5496569
Similar questions