Home > Mobile >  How to change order of input statements on the same line?
How to change order of input statements on the same line?

Time:02-15

I'm a beginner trying to create a dictionary with both keys and values that are inputs.

Trying my_dict[input(x)]=input(y) will prompt the y-input first, but is there a way to switch it so the x-input is the first prompt?

CodePudding user response:

In the case where you can modify your script and put the two separate inputs into variables, you can do the following

y = input()
x = input()

my_dict[x] = y
  • Related