How can I pass input multiple arguments
a = input("enter>") ... ... enter>set name kolya enter>set age 18 And on the conclusion that something like that, well, that would understand
You name kolya and your age 18 How can this be done?
") ... ... enter>set name kolya enter>set age 18 And on the concl...">
How can I pass input multiple arguments
a = input("enter>") ... ... enter>set name kolya enter>set age 18 And on the conclusion that something like that, well, that would understand
You name kolya and your age 18 How can this be done?
The input() function takes only one parameter — a string — and returns a string, too.
The simplest approach is to use it twice:
name, age = input("enter name > "), input("enter age > ") print(f"You name is {name} and you are {age} year old") # Python 3.6+ Input and output:
enter name > John enter age > 17 You name is John and you are 17 year old.
The first command can also be written as an abstraction of the list:
name, age = [input(f"enter {x} > ") for x in ("name", "age")] print("You name {} and your age {}" "".format(input("You name: "), input("your age: "))) Source: https://ru.stackoverflow.com/questions/925053/
All Articles