Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic Quiz/Game
#6
(Nov-17-2018, 06:36 PM)ichabod801 Wrote:
(Nov-17-2018, 06:10 PM)searching1 Wrote: Any idea how can I retain the same question if it's wrong?

To continue asking if the answer is wrong, use a while loop, and exit if the answer is correct. Something like:

        while True:
            student = input(qs[i]+ "\n Ilagay ang iyong sagot: ").upper()
                                 
            if student == an[i].upper():
                print("Correct\n")
                score += 1
                break
               
            else:
                print("\n Wrong! Try Again\n")
                print("Attempt",count)
                count += 1

Result is the same, It;s keeps repeating the question once break has been initiated.
Reply


Messages In This Thread
Basic Quiz/Game - by searching1 - Nov-17-2018, 07:12 AM
RE: Basic Quiz/Game - by j.crater - Nov-17-2018, 09:43 AM
RE: Basic Quiz/Game - by searching1 - Nov-17-2018, 06:10 PM
RE: Basic Quiz/Game - by woooee - Nov-17-2018, 05:35 PM
RE: Basic Quiz/Game - by ichabod801 - Nov-17-2018, 06:36 PM
RE: Basic Quiz/Game - by searching1 - Nov-18-2018, 02:25 AM
RE: Basic Quiz/Game - by ichabod801 - Nov-18-2018, 02:37 AM
RE: Basic Quiz/Game - by searching1 - Nov-18-2018, 02:56 AM
RE: Basic Quiz/Game - by ichabod801 - Nov-18-2018, 03:10 AM
RE: Basic Quiz/Game - by searching1 - Nov-18-2018, 03:31 AM
RE: Basic Quiz/Game - by ichabod801 - Nov-18-2018, 03:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  quiz game - problem with loading statements from file lapiduch 2 1,111 Apr-20-2023, 06:13 PM
Last Post: deanhystad
  Code: Creating a basic python game? searching1 5 3,485 Nov-12-2018, 05:18 AM
Last Post: searching1
  help setting questions and answers in quiz game? yoyoitsjess 3 3,683 May-10-2018, 07:35 AM
Last Post: buran
  Quiz Game Help (ASAP Please!) beginnercoder04 2 3,229 Apr-15-2018, 04:13 AM
Last Post: beginnercoder04

Forum Jump:

User Panel Messages

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