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

  • SEARCH
  • Home
  • 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 6230309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:43:26+00:00 2026-05-24T09:43:26+00:00

I have already created a login() . Trying to ask a random question each

  • 0

I have already created a login(). Trying to ask a random question each time and if answered correctly to run login().

Below is the outline of what I am trying to do:

>>> def human_check():
question1 == raw_input('1+1=')#question.1#
while question1 !== '2':
    print 'sorry robot , try again'
else:
    return login()
question2 == raw_input('the cow jumped over the ....')#question.2#
while question2 !== '2':
    print 'sorry robot , try again'
else:
    return login()
import random
random.question

I imported the random module but how do I group the questions so that random. will work?

SyntaxError: invalid syntax
>>> 
  • 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-24T09:43:27+00:00Added an answer on May 24, 2026 at 9:43 am

    You can do something like this:

    import random
    
    questions = []
    questions.append(("1+1=", "2"))
    questions.append(("the cow jumped over the ....", "moon"))
    
    def human_check():
        random_question = random.choice(questions)
        question, answer = random_question
        user_answer = raw_input(question)
        if user_answer != answer:
           print "Sorry, try again."
        else:
           return login()
    

    Basically, if you maintain some list of questions, you can use random.choice to make a random selection from that list.

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

Sidebar

Related Questions

I have already created a webpart to show the data from list, but I
I have created a turing-complete programming language (already proven) so it must be possible
I have already search for some time over the net on how to create
I have an already existing stored procedure. But when I am trying to create
I have already posted something similar here but I would like to ask the
I have already posted a question about this, but the situation has changed sufficiently
I have already asked this question on ServerFault however I got very minimal replies....one
I created a django application with a user login/registration page. I am trying to
I am trying to run some scripts from C# and I have a script
I have already created a form authentication application. I had User table and created

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.