Python Forum
user inputs in constructing a dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
user inputs in constructing a dictionary
#1
I am making a dictionary, and I called for user input for the key-value combinations, and this was the result:

latin_vocab = {}

latin_vocab[input("Latin word: ")] = input("English meaning: ")

print(latin_vocab)
Quote:English meaning: what
Latin word: quid
{'quid': 'what'}

Process finished with exit code 0

I wasn't expecting it to ask me for the value before it asked me for the key. How do I reverse that (without swapping the content)?
Reply


Messages In This Thread
user inputs in constructing a dictionary - by Exsul - Apr-10-2019, 01:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question How to let the user add 'None' to an specific array in a dictionary? noahverner1995 4 1,869 Dec-26-2021, 10:03 AM
Last Post: noahverner1995
  How to write a response if a user inputs a string horuscope42 3 2,295 Apr-29-2020, 03:39 PM
Last Post: deanhystad
  User input & Dictionary tfernandes 5 3,757 Apr-03-2020, 07:12 PM
Last Post: tfernandes
  Perminantly saving user inputs + being able to retrieve it ThatOneGuyNoOneKnowsCodes 1 2,002 Oct-23-2019, 11:28 PM
Last Post: DT2000
  Trying to prompt user for 2 inputs on one line pythonprogrammer 2 2,561 Sep-15-2019, 04:41 PM
Last Post: snippsat
  unit testing a method that asks two user inputs() in console gebel 0 2,187 Apr-03-2019, 07:59 PM
Last Post: gebel
  User Input to Choose from Dictionary anelliaf 9 26,038 Mar-27-2018, 02:22 PM
Last Post: anelliaf
  question regarding user Inputs cibb 10 7,450 Apr-04-2017, 03:34 AM
Last Post: alicarlos13
  code that takes inputs for user name amounts etc and then sends custom message shaumyabrata 5 5,429 Feb-12-2017, 11:37 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020