write a program that uses input to prompt a user for their name and then welcomes them. note that input will pop up a dialog box. enter Sarah in the pop-up box when you are prompted so your output will match the desired output.

write a program that uses input to prompt a user for their name and then welcomes them. note that input will pop up a dialog box. enter Sarah in the pop-up box when you are prompted so your output will match the desired output


The Python program should prompt a user to enter their name using a dialogue box and it has to print the name with a different dialogue box welcoming the user.

This can be done using a turtle library turtle library is a library that is provided in Python for graphical user interface. 

let's use this library and try to write a Python program to welcome the user



Python Program
=======================


Import the required turtle library then use the text box to ask a user to enter the name and then use the write function to print the welcome message with the name and finally use the done function call to exit the program.

import turtle

name = turtle.textinput("Hi !", "Please Enter Your Name ")

turtle.write("Welcome " + name, font=("", 20, ""))

turtle.done()




OUTPUT
===============

 

write a program that uses input to prompt a user for their name and then welcomes them. note that input will pop up a dialog box. enter Sarah in the pop-up box when you are prompted so your output will match the desired output.



write a program that uses input to prompt a user for their name and then welcomes them. note that input will pop up a dialog box. enter Sarah in the pop-up box when you are prompted so your output will match the desired output.  




Conclusion : This Is The Simple 4 line code to ask the user to enter the name and  to welcome the user and display it.  Try to run the program by yourself and comment down below if you have any queries or suggestions

Post a Comment

0 Comments