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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:33:29+00:00 2026-06-14T18:33:29+00:00

This was a take home test question (which I mailed 20 minutes ago if

  • 0

This was a take home test question (which I mailed 20 minutes ago if Prof. Gruhn is ruthlessly scouring stackoverflow). First computer science course, Intro using Python. Using the book “Starting Out With Python 2nd Ed.” The test was basically on creating our own module libraries, reading and writing to a file, and try/except logic.

The first part asked to create a lottery mumber simulator. One that generated nonunique numbers, the other unique, non repeating numbers. Every answer I saw on here utilized lists, which is sadly the next chapter, and we were expressly forbidden from using them.

My code for this section:

import random

def ballPickerOne():
    a = random.randint(1, 59)
    b = random.randint(1, 59)
    c = random.randint(1, 59)
    d = random.randint(1, 59)
    e = random.randint(1, 59)
    f = random.randint(1, 35)

    showNumbers(a,b,c,d,e,f)


def ballPickerTwo():
   a = random.randrange(1,59,2)
   b = random.randrange(1,59,3)
   c = random.randrange(1,59,5)
   d = random.randrange(1,59,7)
   e = random.randrange(1,59,11)
   f = random.randint(1,35)

   showNumbers(a,b,c,d,e,f)


def showNumbers(a,b,c,d,e,f):

   print("Your Numbers ...")
   print()
   print("Ball 1: ", a)
   print("Ball 2: ", b)
   print("Ball 3: ", c)
   print("Ball 4: ", d)
   print("Ball 5: ", e)
   print("Red Ball: ", f)
   print()
   print("Good Luck")

We were required to use the showNumbers function to display the results, and in the format that would result from it. ballPickerTwo is the “unique” one, which I used prime number intervals in a failed attempt at uniqueness. I toyed with using a loop, but couldn’t figure out how to display the numbers generated using showNumbers.

  • 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-14T18:33:30+00:00Added an answer on June 14, 2026 at 6:33 pm

    This is a really tedious way of doing it, but it doesn’t use lists. It will pick random and unique values.

    def ballPickerTwo():
    
        a = random.randint(1, 59)
    
        b = a        
        while b == a:
            b = random.randint(1, 59)
    
        c = b
        while c == b or c == a:
            c = random.randint(1, 59)
    
        d = c
        while d == c or d == b or d == a:
            d = random.randint(1, 59)
    
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm supposed to take this at-home skills test for a potential employer. They threw
Well, I can't seem to solve this XSLT 1.0 take-home quiz problem. Here's the
I have code like this: // Take the xml message and turn it into
I know dbsight allows synonyms and stop words for searching but does this take
Take this example: {-# OPTIONS_HADDOCK ignore-exports #-} module HaddockTest (e1) where -- * Exported
Take this Lorem Ipsum text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla
Take this query: SELECT * FROM MyTable WHERE MyColumn = 'SomeValue' ORDER BY SomeFakeQualifier.MyColumn
Take this example code (ignore it being horribly inefficient for the moment) let listToString
Take this sample class as an example: [AttributeUsage(AttributeTargets.All, AllowMultiple=true)] public class BugFixAttribute : System.Attribute
Take this code into consideration: Proxy p = new Proxy(Type.SOCKS, new InetSocketAddress(proxyURL, port)); try

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.