Python Forum
Help solving a task - beginner stuff.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help solving a task - beginner stuff.
#3
(Aug-21-2019, 03:06 PM)buran Wrote:
(Aug-21-2019, 02:50 PM)Kristen Wrote: I've tried many different things, but I think I struggle with building the function correctly
Please, post your best attempt at solving this task. Post your code in python tags, full traceback (if you get any errors) + in error tag.


Hi,
Thanks for the reply. This is my best attempt, there are planty of things wrong with this:
answer = "R"

    
def letter_guess(check_guess):
    first_attempt = input("Guess a letter: " )
    second_attempt = input("Try again: " )
    third_attempt = input("And again: ")
    if first_attempt.upper() in answer == True:
        print("True")
    elif second_attempt.upper() in answer == True:
        print("True")
    elif third_attempt.upper() in answer == True:
        print("True")
    else:
        print ("False")

letter_guess(check_guess)
Its not exactly what the instructions are saying to do, in addition to getting the output "False" even when the guess is "r" which is the answer.
Would appriciate if you could show me how you would write this, I think I am also not entirely understanding how to build these functions correctly.

Thank you.
Reply


Messages In This Thread
Help solving a task - beginner stuff. - by Kristen - Aug-21-2019, 02:50 PM
RE: Help solving a task - beginner stuff. - by Kristen - Aug-25-2019, 09:10 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020