name = input("Hi! What’s your name ? ")
print("Nice to meet you " + name + "!")
age = input("How old are you ? ")
print("So, you are already " + str(age) + " years old, " + name + " !")
# Taking string input
a = input("Enter a string: ")
print("String is: ", a)
# Taking integer input
b = int(input("Enter an integer: "))
print("Integer is: ", b)
# Taking float input
c = float(input("Enter a float value: "))
print("Float value is: ", c)
age = input('what is your age?: ')
print("You are "+age + " years old")
ans : what is your age?: 23
You are 23 years old
#input method in python.A selected question would prompt and user should ans that.
#after that programme will show age with a text message.
// if you want to take single int input
a=int(input())
// if you want n elements of array a as input from console/user
a = list(map(int,input().strip().split()))
# u can also covert it to set,tuple etc
# ex. set(map(int, input().strip().split()))
NOTE: suppose if you want a list with duplicates removed
list(set(map(int, input().strip().split())))
also note map is a method and is not hashmap which is actually disct in python.
and ommitting .strip() in 2nd argument of map func might also work.
# more explaination of above:
https://www.quora.com/What-does-the-following-line-mean-in-Python-list-map-int-input-strip-split-I
lis = ["log('", "')"]
x = input()
# This allows you to type: log('ANY') and it will detect whats inside of the quotes and it will print into the console "ANY"
for i in lis:
if i in x:
if i == lis[0]:
y = x.split("'")
print(y[1])
Use the input() method
Example
#code
name = input("Name Please: ")
print(f'Hello {name}, what can I do for you?')
#console
Name Please:
>>> Steve
Hello Steve, what can I do for you?