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 8527273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:30:38+00:00 2026-06-11T08:30:38+00:00

I am a beginer python learner. I am trying to create a basic dictionary

  • 0

I am a beginer python learner. I am trying to create a basic dictionary where random meaning of words will come and user have to input the correct word. I used the following method, but random doesn’t work. I always get the first word first and when the last word finishes, I get infinite ‘none’ until I kill it. Using python 3.2

from random import choice


print("Welcome , let's get started")
input()

def word():
    print('Humiliate')
    a = input(':')
    while a == 'abasement':
        break
    else:
        word()
    #   --------------------------------------------------------- #



def word1():
    print('Swelling')
    a = input(':')
    while a == 'billowing':
        break
    else:
        word()
#   ------------------------------------------------------------ #


wooo = [word(),word1()]
while 1==1:
    print(choice(wooo))

is there any faster way of doing this and get real random? I tried classes but it seems harder than this. Also, is there any way I can make python not care about weather the input is capital letter or not?

  • 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-06-11T08:30:39+00:00Added an answer on June 11, 2026 at 8:30 am

    To answer one part of your question (“is there any way I can make python not care about weather the input is capital letter or not?”): use some_string.lower():

    >>> "foo".lower() == "foo"
    True
    >>> "FOO".lower() == "foo"
    True
    

    An this is to help you how you could improve the structure of your code:

    import sys
    from random import choice
    
    WORDPAIRS = [('Humiliate', 'abasement'), ('Swelling', 'billowing')]
    
    def ask():
        pair = choice(WORDPAIRS)
        while True:
            answer = raw_input("%s: " % pair[0]).lower()
            if answer == pair[1]:
                print "well done!"
                return
    
    
    def main():
        try:
            while True:
                ask()
        except KeyboardInterrupt:
            sys.exit(0)
    
    
    if __name__ == "__main__":
        main()
    

    It works like that:

    $ python lulu.py 
    Swelling: lol
    Swelling: rofl
    Swelling: billowing
    well done!
    Humiliate: rofl
    Humiliate: Abasement
    well done!
    Swelling: BILLOWING
    well done!
    Humiliate: ^C
    $
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a beginner with Python and trying few programs. I have something like
I'm trying to solve a two-dimensional random walk problem from the book, exploring python.
I'm a very beginner in python and django. However I'm trying to create a
As part of the last assignment in a beginner python programing class, I have
Python beginner here, I have a list of lists and want to refer to
Python beginner here. I have a text file that is sorted into columns: fields
I'm a Python beginner and have just started using packages. When you're calling a
I am a beginner of Python. I am trying now figuring out why the
I am quite a beginner to Python and trying to get my head around
A beginner's Python question: I have a string with x number of sentences. How

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.