Please draw the correct flowchart for this game ?

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter4: Making Decisions
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question

Please draw the correct flowchart for this game ?

# Function to display question and answer

def new_game():

    guesses = []

    Right_guesses = 0

    question_num = 1

    num = 1

    for key in questions:

        print("\n------------------------- \n")

        print("Question " + str(num) + "\n" )

        num += 1

        print(key)

        for i in options[question_num-1]:

            print(i)

        guess = input("\nAnswer (A, B, C, or D): ")

        guess = guess.upper()

        guesses.append(guess)

        Right_guesses += check_answer(questions.get(key), guess)

        question_num += 1

    display_score(Right_guesses, guesses)

# -------------------------

# Function to check answer

def check_answer(answer, guess):

    if answer == guess:

        print("\nYour Answer Correct!")

        return 1

    else:

        print("\nYour Answer Wrong!")

        return 0

# -------------------------

# Function to display score

def display_score(Right_guesses, guesses):

    print("\n-------------------------")

    print( "\t" + name.capitalize() + " Result")

    print("-------------------------")

    print( "\n" + name.capitalize() + " Answers: \n", end="")

    for i in questions:

        print(questions.get(i), end=" ")

    print()

    print("\n" + name.capitalize() + " Guesses: \n", end="")

    for i in guesses:

        print(i, end=" ")

    print()

    score = int((Right_guesses/len(questions))*100)

    print("\n" + name.capitalize() + " Score: "+str(score)+"%")

    

    if score >= 70 :

      print ("\nCongratulation " +  name.capitalize() + "!!")

    else:

      print ("\nYour Failed, Try Again")

# -------------------------

# Function to user want play again

def play_again():

    response = input("\nDo you want to play again? (yes or no): ")

    response = response.upper()

    if response == "YES":

        return True

    else:

        return False

# -------------------------

# List Question and Answer

questions = {

  "The term “Islam” means?: ": "A",

  "Muslims believe that Muhammad was?: ": "D",

  "Which of the following is an essential part of Islamic belief?: ": "D",

  "The chapters of the Qur'an are known as?: ": "A"

}

options = [["A. submission", "B. peace", "C. fortitude", "D. thankfulness"],

          ["A. the first prophet", "B. the final prophet", "C. one of many prophets", "D. both b and c"],

          ["A. The belief in the oneness of God", "B. The belief in the Day of Judgment", "C. The belief in prophets", "D. All of the above"],

          ["A. surahs","B. sunnahs", "C. shari'ah", "D. sufis"]]

# -------------------------

# Main function

print ("-------------------------")

print (" Welcome To Our Games ")

print ("-------------------------")

name = input("\nWhat is your name? : ")

response = input("\nDo you want to play games? (yes or no): ")

response = response.upper()

if response == "YES":

  new_game()

  while play_again():

    new_game()

print("\nThank You and See You Again !!")

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Concept of Flowchart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,