Input Function in Python - Ryzen Hunt

input function

The input() function in python

While creating a program, programmers or developers often need to interact with users, to gather data. In other input() function is used to collect data from users as string.

examples 1: 

>>> a = input("Enter your name : ")
>>>print(a)

Output
Enter your name: Ryzen Hunt
Ryzen Hunt
example 1 screenshot

example 2:
>>>R = input("Enter the first name : ")
>>>H = input("Enter the second name : ")
>>>A = R+H
>>>print(A)

Output
Enter the first name: Ryzen
Enter the second name: Hunt
Ryzen Hunt
example 2 screenshot

Note: Data provided by the user is considered a string.


example 3:
>>> x = int(input("Enter the first number : "))
>>> y = int(input("Enter the second number : "))
>>> z = x+y
>>>print(z)

Output
Enter the first number: 45
Enter the second number: 5
50
example 3 screenshot




Please share this with your friends and Don't forget to share your comments and valuable suggestions and feedback.
To visit our Python Course series click here, and for HTML course series click here.

You may like these posts

  1. To insert a code use <i rel="pre">code_here</i>
  2. To insert a quote use <b rel="quote">your_qoute</b>
  3. To insert a picture use <i rel="image">url_image_here</i>