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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:37:18+00:00 2026-06-13T07:37:18+00:00

The Question guess_letter: (str, str) -> str The first parameter is the unguessed consonants

  • 0

The Question

guess_letter:
(str, str) -> str

The first parameter is the unguessed consonants and the second is the difficulty level. Return the consonant to be guessed next by the computer player. If level is EASY, the consonant to guess is randomly selected. If level is HARD, the consonant to guess the first consonant in PRIORITY_CONSONANTS that occurs in the first parameter.

PRIORITY_CONSONANTS = 'tnrslhdcmpfgybwvkqxjz'
EASY = 'E'
HARD = 'H'

Overall this project will create a functional Hangman game, this is one component of it which I have to code myself.

I don’t know how to write this I made a small construct that I wanted to work around. But I honestly don’t understand what to write.

I want that when the difficulty level is hard it to select the first consonant in priority consonants that appears in the parameter unguessed consonants
and when it is easy I want any random consonant to appear

guess_letters(unguessed_consonants, difficulty_level):
if difficulty_level == EASY:
if difficulty_level ==HARD:
  • 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-13T07:37:19+00:00Added an answer on June 13, 2026 at 7:37 am
    import random
    
    EASY = 'E'
    HARD = 'H'
    PRIORITY_CONSONANTS = 'tnrslhdcmpfgybwvkqxjz'
    EASY_CONSONANTS = '' # what should be here?
    
    def guess_letters(unguessed_consonants, difficulty_level):
        if difficulty_level == EASY:
            search_set = EASY_CONSONANTS
        elif difficulty_level == HARD:
            search_set = PRIORITY_CONSONANTS
    
        for con in unguessed_consonants:
            if con in search_set:
                 return con
    

    In response to the comment by Nadia:

    kk that worked better except if i input ‘zk’ on hard it will give me z instead of k k comes before z in the PRIORITY_CONSONANTS so the output should be k

    In that case, search_set should be iterated over first:

        for con in search_set:
            if con in unguessed_consonants:
                 return con
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is very basic magento question i guess. I want to first get all
Note first of all that this question is not tagged winforms or wpf or
Simple question I guess, I want to use PHP to write an update to
This is a simple question,I guess, but I couldn't figure it out. How do
Here's the main question I guess : Is there a .NET way to get
This is more of a general design question I guess... I have an Ajax
A little stuck here. I have a simple question I guess. Given the following
I guess the question title sums it up. Is there a time when it
Okay guess this question looks a lot like: What is the best way to
I guess this question will sound familiar, but I am yet another programmer baffled

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.