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
#4
Here's a little design tweak:

while True:
    new_key = input("\nLatin word (or 'stop' to stop): ")
    if new_key == 'stop':
        break
    latin_vocab[new_key] = input("English meaning: ")
    print(" ")
    print("Current list: " + str(latin_vocab))
Now the user doesn't have to keep hitting return at the stop question to keep going.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


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

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,827 Dec-26-2021, 10:03 AM
Last Post: noahverner1995
  How to write a response if a user inputs a string horuscope42 3 2,263 Apr-29-2020, 03:39 PM
Last Post: deanhystad
  User input & Dictionary tfernandes 5 3,687 Apr-03-2020, 07:12 PM
Last Post: tfernandes
  Perminantly saving user inputs + being able to retrieve it ThatOneGuyNoOneKnowsCodes 1 1,957 Oct-23-2019, 11:28 PM
Last Post: DT2000
  Trying to prompt user for 2 inputs on one line pythonprogrammer 2 2,532 Sep-15-2019, 04:41 PM
Last Post: snippsat
  unit testing a method that asks two user inputs() in console gebel 0 2,168 Apr-03-2019, 07:59 PM
Last Post: gebel
  User Input to Choose from Dictionary anelliaf 9 25,923 Mar-27-2018, 02:22 PM
Last Post: anelliaf
  question regarding user Inputs cibb 10 7,307 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,360 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