Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6796055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:25:16+00:00 2026-05-26T18:25:16+00:00

Right now my flashcard game is using a prepvocab() method where I define the

  • 0

Right now my flashcard game is using a prepvocab() method where I

  • define the terms and translations for a week’s worth of terms as a dictionary
  • add a description of that week’s terms
  • lump them into a list of dictionaries, where a user selects their “weeks” to study

Every time I add a new week’s worth of terms and translations, I’m stuck adding another element to the list of available dictionaries. I can definitely see this as not being a Good Thing.

class Vocab(object):

def __init__(self):
    vocab = {}
    self.new_vocab = vocab
    self.prepvocab()

def prepvocab(self):
    week01 = {"term":"translation"} #and many more...
    week01d = "Simple Latvian words"

    week02 = {"term":"translation"}
    week02d = "Simple Latvian colors"

    week03 = {"I need to add this":"to self.selvocab below"}
    week03d = "Body parts"

    self.selvocab = [week01, week02] #, week03, weekn]
    self.descs = [week01d, week02d] #, week03, weekn]
    Vocab.selvocab(self)

def selvocab(self):
    """I like this because as long as I maintain self.selvocab,
    the for loop cycles through the options just fine"""
    for x in range(self.selvocab):
        YN = input("Would you like to add week " \
                   + repr(x + 1) + " vocab? (y or n) \n" \
                   "Description: " + self.descs[x] + " ").lower()
        if YN in "yes":
            self.new_vocab.update(self.selvocab[x])
    self.makevocab()

I can definitely see that this is going to be a pain with 20+ yes no questions. I’m reading up on curses at the moment, and was thinking of printing all the descriptions at once, and letting the user pick all that they’d like to study for the round.

How do I keep this part of my code better maintained? Anybody got a radical overhaul that isn’t so….procedural?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:25:17+00:00Added an answer on May 26, 2026 at 6:25 pm

    Pickling objects into a database means it’ll take some effort to create an interface to modify the weekly lessons from the front end, but is well worth the time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I can call a method using ajax (:remote=> 'true') at awisprotect_path by
Right now I am using this code to download files (with a Range header).
Right now I'm using Controller_Template would like to have RESTful URLs though, is it
Right now I've been using GDB to disassemble a binary file and check out
Right now, I have three models Post, Comment and User (using Devise ) associated
right now i m using adobe live media encoder to stream live webcam video
Right now I have the following piece of code: RSpec::Matchers.define :include_an_html_tag do |tag| tag
Right now, I'm using this to allow a file to be moved to our
right now I'm creating an array and using: render :json => @comments This would
Right now I'm stuck between using PHP's native session management, or creating my own

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.