From 20e48cf305735ab62f3d6873a7052c9376fa2284 Mon Sep 17 00:00:00 2001 From: Souma Kanti Ghosh <40127554+SubCoder1@users.noreply.github.com> Date: Thu, 13 Dec 2018 22:08:48 +0530 Subject: [PATCH 1/4] Taking Input in Python 3.x Insights about the built-in input() function in Python 3.x, used to take an input from the user. --- Text Input - Output/Input | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Text Input - Output/Input diff --git a/Text Input - Output/Input b/Text Input - Output/Input new file mode 100644 index 0000000..35a1644 --- /dev/null +++ b/Text Input - Output/Input @@ -0,0 +1,10 @@ +""" In Python 3.x, a built-in input() function is used to ask a user for an input. The user can stop typing and submitting the input + by pressing the ENTER or RETURN key. To capture the input taken by input(), A variable is needed. + A variable is a container to hold data """ + +user_input = input() + +""" To tell the user what to type as an input, a quoted text using single or double commas are used inside the parenthesis of input() + function """ + +input_hint = input("type your name - ") From 1627b13294fc15f72a4108f6b452f23db5cb0508 Mon Sep 17 00:00:00 2001 From: Souma Kanti Ghosh <40127554+SubCoder1@users.noreply.github.com> Date: Thu, 13 Dec 2018 22:33:06 +0530 Subject: [PATCH 2/4] Use of input() function in Python 3.x Use and further insights on input() built-in function in Python 3.x to take input from an User. --- Text Input - Output/{Input => Input.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Text Input - Output/{Input => Input.py} (100%) diff --git a/Text Input - Output/Input b/Text Input - Output/Input.py similarity index 100% rename from Text Input - Output/Input rename to Text Input - Output/Input.py From a114d827d2de7361bcf3e075bebba6aed367b3bb Mon Sep 17 00:00:00 2001 From: Souma Kanti Ghosh <40127554+SubCoder1@users.noreply.github.com> Date: Thu, 13 Dec 2018 23:17:41 +0530 Subject: [PATCH 3/4] Use of input() function in Python 3.x Insights and usage of input() built-in function in Python 3.x to take inputs from user. --- Text Input - Output/Input.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Text Input - Output/Input.py b/Text Input - Output/Input.py index 35a1644..6fd5937 100644 --- a/Text Input - Output/Input.py +++ b/Text Input - Output/Input.py @@ -8,3 +8,8 @@ function """ input_hint = input("type your name - ") + +""" A variable can also be passed instead of an hard-coded quoted text inside the parenthesis of input() """ + +hint = "type your birthdate - " +birthdate = input(hint) From 889118c655cb403ab0a1e01c0f74d65b9109612f Mon Sep 17 00:00:00 2001 From: Souma Kanti Ghosh <40127554+SubCoder1@users.noreply.github.com> Date: Thu, 13 Dec 2018 23:48:01 +0530 Subject: [PATCH 4/4] All about input() in Python 3.x --- Text Input - Output/Input.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Text Input - Output/Input.py b/Text Input - Output/Input.py index 6fd5937..633ce83 100644 --- a/Text Input - Output/Input.py +++ b/Text Input - Output/Input.py @@ -4,12 +4,36 @@ user_input = input() +""" input() can also work without even storing the submitted data by the user, but it's of no use """ +input() + """ To tell the user what to type as an input, a quoted text using single or double commas are used inside the parenthesis of input() function """ input_hint = input("type your name - ") -""" A variable can also be passed instead of an hard-coded quoted text inside the parenthesis of input() """ +""" A variable can also be passed (of any type) instead of an hard-coded quoted text inside the parenthesis of input() """ + +string_hint = "type your birthdate - " +list_hint = ['A List was passed'] +num_hint = 123 + +string_hint_input = input(string_hint) +list_hint_input = input(list_hint) +num_hint_input = input(num_hint) + +""" + Concatenation of strings(quoted text) OR addition of variables OR addition of a variable and quoted texts are also possible + inside the parenthesis of input() + + Note :- Spaces should be given after the end of any quoted texts because Python doesn't automatically separate added strings by spaces + +""" + +text_text_dump = input("type " + "your " + "Password '>' ") # Adding hard-coded quoted texts inside () + +text_1 = "Are you " +text_2 = "a geek? " +var_var_dump = input(text_1 + text_2) # Adding variables inside () -hint = "type your birthdate - " -birthdate = input(hint) +var_text_dump = input(text_1 + " '>' ") # Adding a variable and quoted text inside ()