Home > Software engineering >  How to convert the inputted data using the variable values in python
How to convert the inputted data using the variable values in python

Time:07-14

i want to print the inputted values using the values of my creates variables in python. I am a beginner in python.

name = input('Encode ')
a = 1
b = 2
c = 3
print(name)

If my put a,b,c it exactly gives me a,b,c and it should give me this value but I want Like if i run the program and input a,b,c i want python to get the value of a which is 1, then the value of b which is 2 and the value of c which is 3 and print 1,2,3 or 1 2 3 on my screen.

CodePudding user response:

to get multiple values as input at a time

name = list(map(int, input().split()))

you give input 1 2 3

so name will be a list which store value as [1,2,3]

if you want to save them as 1 2 3 just do simple input

CodePudding user response:

You should try to go through basics of python before coming here.

a = int(input())
b = int(input())
c = int(input())

print(a,end=',')
print(b,end=',')
print(c,end=',')

end here is to prevent a new line

  • Related