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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:15:57+00:00 2026-06-18T03:15:57+00:00

codes = [A, B, C, D, E] random.shuffle(codes) def print_message(message): print \n print -*10

  • 0
codes = ["A", "B", "C", "D", "E"]
random.shuffle(codes)

    def print_message(message):
        print "\n"
        print "-"*10
        print message
        print "-"*10
        print "\n"

    print_message('This is a test of the %s system' % codes[0])

How do I then do an if statement for the results of the print_message(‘This… ‘) based on the random letter that is presented.

Example. If the result of codes[0] ended up being “A” for the print_message() then you would see this printed on the screen:

----------
This is a test of the A system. 
The A system is really great. 
---------

Run the command a few more times and you’d see:

----------
This is a test of the C system.
The C system sucks. 
----------

----------
This is a test of the B system. 
The B system has improved greatly over the years. 
----------
  • 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-18T03:15:58+00:00Added an answer on June 18, 2026 at 3:15 am

    This would give you the results of the examples in your question:

    #! /usr/bin/env python
    import random
    codes = ["A", "B", "C", "D", "E"]
    random.shuffle(codes)
    
    def print_sys_result(sys_code):
        results = {
            "A": "is really great",
            "B": "has improved greatly over the years",
            "C": "sucks",
            "D": "screwed us up really badly",
            "E": "stinks like monkey balls"
        }
        print "\n"
        print "-"*10
        print 'This is a test of the {0} system'.format(sys_code)
        if sys_code in results:
            print "The {0} system {1}.".format(sys_code, results[sys_code])
        else:
            print "No results available for system " + sys_code
        print "-"*10
        print "\n"
    
    print_sys_result(codes[0])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into unbound method error in python with this code: import random class
Im planing on using this code to make random sounds play with an action,
I use this code to generate a random number. Random R = new Random(0);
I would like to implement a shuffle function, I have this piece of code
I made this very simple solitaire in C++. The deck is random shuffled, I
I recently posted this question about codes for a gift-card-like voucher that users can
I found this piece of Java code at Wikipedia that is supposed to shuffle
I have the following code for Shuffle so far, public static IList<T> Shuffle<T>(this IList<T>
When I run this code: from nltk import NaiveBayesClassifier,classify import USSSALoader import random class
I want to show the shuffle word inside the Textfield. so far this is

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.