Popular Posts

Tuesday, August 18, 2020

Python Beginner: Getting Input from Users

 Hello, developer!


Now you had a good understanding of using strings and numbers type variables with functions.

Today, we will learn about the "Input" command. It enables we can make interactive program through getting input from users.


Are you ready to start learning? Let's create new codes. 

We can get user's input by value as below command


variable = input("Input messageText")

(i.e: name = input("Input your name: "))


Python will show "Input message Text on command prompt at the console window and user can input Text or numbers. 


I showed input exercise codes and running results as below screenshots.

name = input ("Enter your name: ")
age = input ("Enter your age: ")
print("Hello " + name + "! You'are " + age)


Is it interesting? I recommend you to have some tests on this input command with max limitation of strings and numbers can be calculated as well as number type variables.


Here are my test results for my questions. Please have a good exercise, developer! :)



 



 

No comments:

Post a Comment

Python - Web crawling exercises

Hello Python developer! How are you? Hope you've been good and had wonderful time with Python. There are 10 Python requests module exerc...