Python Direct | Using Keyboard Input Function. (Input & Raw_Input)

Python Guide | Using Keyboard Input Function. (input & raw_input).

Python Keyboard Input. Here is a basic python tutorial, nosotros volition larn how to utilization input keyboard part on this program. Almost every computer program surely utilization the keyboard input commands. In fact, in that place are a diversity of ways to mail an input. For representative input from the keyboard, from a mouse click, input from the database, input from to a greater extent than or less other computer. For this case, nosotros volition demo you lot how to utilization input function, nosotros tin input string information or integer data. 

There are ii kinds of input commands you lot involve to know, 
  • First, raw_input
    • This ascendence reads a business from input, then returns a string past times stripping a trailing newline.
  • Second, input
    • Used to get an expression from the keyboard input, for example, mathematics seem (3*3, 9+2, 5/2, ...etc) 
So, if you lot nevertheless confuse amongst my explanations. Now follow the tutorial remove below.

Raw_input

  1. Syntax 1.
  2. data = raw_input('please input your information hither :') impress (data)
    • Result.
       nosotros volition larn how to utilization input keyboard part on this computer program Python Guide | Using Keyboard Input Function. (input & raw_input)
      python raw_input example
  3. Syntax 2. the syntax read the Address using raw_input() together with display dorsum on the hide using print():

  4. name=raw_input('Who is your refer ? ') impress ("Hello %s, Nice to run into you" % name);
    • Result
    •  nosotros volition larn how to utilization input keyboard part on this computer program Python Guide | Using Keyboard Input Function. (input & raw_input)
      python raw_input example
  5. Syntax 3.

  6. name=raw_input("Who is your name\t:"); Address=raw_input("Where is your Address\t:"); print"Your Name is\t\t:",name print"You alive in\t\t:",Address
    • Result
       nosotros volition larn how to utilization input keyboard part on this computer program Python Guide | Using Keyboard Input Function. (input & raw_input)
      raw_input python

Input.

Only Integer information type tin live on entered here.
  1. Math Operations.
  2. result=input("Calculation :") impress result
    • result.
       nosotros volition larn how to utilization input keyboard part on this computer program Python Guide | Using Keyboard Input Function. (input & raw_input)
      input python
  3. the syntax read the Address using raw_input() together with input () together with thence display dorsum on the hide using print():
  4. yourname = raw_input("What's your name? ") print("Nice to run into you lot " + yourname + "!") historic menses = input("Your age? ") print("So, you lot are already " + str(age) + " years old, " + yourname + "!")
    • Result.
       nosotros volition larn how to utilization input keyboard part on this computer program Python Guide | Using Keyboard Input Function. (input & raw_input)
      raw_input together with input python