Students were enquired to answer a question at institution and to assert what is most important for them to succeed. From the numerous responses, one which that stood out was practice. People who are successful do not become successful by being born. They work hard and persistence their lives to succeeding. This is how you can attain your goals. just below are one of the answer and question example that you would possibly use to practice and elevate your information and also give you insights that might just help you to maintain your study in school.
Question:
[Edhesive] 4.1 Code Practice Write a program that asks the user to enter a name, and then prints 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
Answer:
Following are the Python program to an input string value and print value with the message:
Program Explanation:
- Defining the while loop that runs condition is true.
- Defining a variable “user_name” that uses the input method to input value from the user-end.
- After input value the if conditional block is used that checks input value is equal to “Nope” when the condition is true it uses the break keyword and print values with the message.
Program:
while True:#defining loop that runs when condition is true
user_name = input(‘Enter your name:(Nope to end): ‘)#defining a variable user_name that input value
if user_name == ‘Nope’:#defining if block that checks input string value equal to Nope
break#using break keyword
print(‘Nice to meet you {}’.format(user_name))#print message
Output:
Please find the attachment.
Learn more:
From the answer and question examples above, hopefully, they can potentially help the student answer the question they had been looking for and observe of every piece stated in the answer above. Then may possibly carry out some sharing in a group discussion and also learning with the classmate in connection with the topic, so another student also gain some enlightenment and still keeps up the school learning.