1. The game begins by welcoming the player and asking their name. Input verification is not needed. 2. It then displays the rules of the game and asks for a non-zero positive integer n. Your program must verify the user input. 3. Next, it repeatedly shows options to the player; a set of four quiz questions (described in the next section) and an option to quit the game. 4. The player can select any question of their choice or decide to quit the game at this point. The same question can be selected multiple times. Assignment # 2 Due: Oct 17th, 11:59 PM Page 5 of 11 5. For every question, your program must generate a random DNA strand of length n. The player must answer the selected question for this DNA. 6. The player receives points for every correct answer (see the sample output). Otherwise, they lose 1 point per incorrect answer. Your program must compute the correct answer for a question, verify the player’s answer, and award points accordingly. 7. After every attempt, your program must display the current score to the player. 8. The game ends only when the player decides to quit. If the game ends with 10 or more points, the player wins, and your program must congratulate them. Otherwise, it must thank the user for playing before terminating the game. 9. Note: users are always allowed to enter any type of data when asked for input. Your program must always verify the user input. Invalid input should be handled with suitable error messages and the prompt should be repeated. To keep things simple, we will consider that when prompted a user enters either an integer or a string (i.e., you do not need to check for other data types). Also note that user inputs that are of type strings are not case-sensitive (i.e., it can be any combination of lowercase and uppercase letters).
1. The game begins by welcoming the player and asking their name. Input verification is not needed. 2. It then displays the rules of the game and asks for a non-zero positive integer n. Your program must verify the user input. 3. Next, it repeatedly shows options to the player; a set of four quiz questions (described in the next section) and an option to quit the game. 4. The player can select any question of their choice or decide to quit the game at this point. The same question can be selected multiple times. Assignment # 2 Due: Oct 17th, 11:59 PM Page 5 of 11 5. For every question, your program must generate a random DNA strand of length n. The player must answer the selected question for this DNA. 6. The player receives points for every correct answer (see the sample output). Otherwise, they lose 1 point per incorrect answer. Your program must compute the correct answer for a question, verify the player’s answer, and award points accordingly. 7. After every attempt, your program must display the current score to the player. 8. The game ends only when the player decides to quit. If the game ends with 10 or more points, the player wins, and your program must congratulate them. Otherwise, it must thank the user for playing before terminating the game. 9. Note: users are always allowed to enter any type of data when asked for input. Your program must always verify the user input. Invalid input should be handled with suitable error messages and the prompt should be repeated. To keep things simple, we will consider that when prompted a user enters either an integer or a string (i.e., you do not need to check for other data types). Also note that user inputs that are of type strings are not case-sensitive (i.e., it can be any combination of lowercase and uppercase letters).
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Concept explainers
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Question
1. The game begins by welcoming the player and asking their name. Input verification is not
needed.
2. It then displays the rules of the game and asks for a non-zero positive integer n. Your program
must verify the user input.
3. Next, it repeatedly shows options to the player; a set of four quiz questions (described in the
next section) and an option to quit the game.
4. The player can select any question of their choice or decide to quit the game at this point.
The same question can be selected multiple times.
Assignment # 2 Due: Oct 17th, 11:59 PM
Page 5 of 11
5. For every question, your program must generate a random DNA strand of length n. The
player must answer the selected question for this DNA.
6. The player receives points for every correct answer (see the sample output). Otherwise, they
lose 1 point per incorrect answer. Your program must compute the correct answer for a
question, verify the player’s answer, and award points accordingly.
7. After every attempt, your program must display the current score to the player.
8. The game ends only when the player decides to quit. If the game ends with 10 or more points,
the player wins, and your program must congratulate them. Otherwise, it must thank the
user for playing before terminating the game.
9. Note: users are always allowed to enter any type of data when asked for input. Your program
must always verify the user input. Invalid input should be handled with suitable error
messages and the prompt should be repeated. To keep things simple, we will consider that
when prompted a user enters either an integer or a string (i.e., you do not need to check for
other data types). Also note that user inputs that are of type strings are not case-sensitive
(i.e., it can be any combination of lowercase and uppercase letters).
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
this code only prints random dna letters where is the game there are the questions below
Find the complement of a DNA strand: recall that a DNA strand is a combination of four
uppercase letters; A, T, C, and G. The letters A and T are complements, and the letters C
and G are complements. To find the complement of a DNA strand you must replace each
character with its complement. For example, ATCGG is the complement of TAGCC and
CCC is the complement of GGG. Your program must show a DNA of a predefined length
to the player and ask for its complement.
2. Find the reversed DNA strand: the order of the characters in a DNA strand should be
reversed. Examples: GCTAA is the reverse of AATCG and AA is the reverse of AA. Your
program must show a DNA of a predefined length to the player and ask for the reversed
strand.
3. Find the compressed DNA strand: all repeated characters in a DNA strand should be
replaced by the number of repeats followed by that character once. For example, 2C3AT
is the compressed form of CCAAAT, G2TA3GC is the compressed form of GTTAGGGC, and
uppercase letters; A, T, C, and G. The letters A and T are complements, and the letters C
and G are complements. To find the complement of a DNA strand you must replace each
character with its complement. For example, ATCGG is the complement of TAGCC and
CCC is the complement of GGG. Your program must show a DNA of a predefined length
to the player and ask for its complement.
2. Find the reversed DNA strand: the order of the characters in a DNA strand should be
reversed. Examples: GCTAA is the reverse of AATCG and AA is the reverse of AA. Your
program must show a DNA of a predefined length to the player and ask for the reversed
strand.
3. Find the compressed DNA strand: all repeated characters in a DNA strand should be
replaced by the number of repeats followed by that character once. For example, 2C3AT
is the compressed form of CCAAAT, G2TA3GC is the compressed form of GTTAGGGC, and
Assignment # 2 Due: Oct 17th, 11:59 PM
Page 6 of 11
TAGC is the compressed form of TAGC. Your program must show a DNA of a predefined
length to the player and ask for its compressed form.
4. Find the expanded DNA strand: this is the opposite of the compression technique
described in 3. So, it basically undoes the compressing. For example, CAGGTTT is the
expanded form of CA2G3T, TATTGC is the expanded form of TA2TGC, and TAGC is the
expanded form of TAGC. Your program must show a compressed DNA to the player and
ask for its expanded form. The expanded DNA must have the predefined length (n).
Page 6 of 11
TAGC is the compressed form of TAGC. Your program must show a DNA of a predefined
length to the player and ask for its compressed form.
4. Find the expanded DNA strand: this is the opposite of the compression technique
described in 3. So, it basically undoes the compressing. For example, CAGGTTT is the
expanded form of CA2G3T, TATTGC is the expanded form of TA2TGC, and TAGC is the
expanded form of TAGC. Your program must show a compressed DNA to the player and
ask for its expanded form. The expanded DNA must have the predefined length (n).
i was started but got only this far
import string
import random
from random import choice
from random import choice
print("Welcome to the DNA quiz game!")
u=input("Enter your username: ")
count=int(input("Hi " + u + ", please enter a positive integer for the DNA length: "))
print()
from random import choice
def String(length):
DNA=""
for count in range(length):
DNA+=choice("CGTA")
return DNA
print("Select an option [1-4] to answer a question or 5 to quit the game.")
print( "Win the game by scoring at least 10 points! ")
print(" 1. Complement [2 points] 2. Reverse [2 points] 3. Compress [3 point] 4. Expand [3 points] 5. Quit")
y=int(input())
while y==5:
break
while 1<=y<=4:
if y==1:
pass
while y<1 or y>5:
y=int(input("Please enter a digit between [1-5]: "))
Solution
by Bartleby Expert
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education