Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Is this a good game for a beginner like me? Python 3

+3 votes
asked Apr 23, 2019 by WilliamPython1 (180 points)
import random
import time
import sys
loading = True
welcome = True
#print('Loading',time.sleep(1),'.',time.sleep(1),'.',time.sleep(1),".")
while loading == True:
    print('L')
    time.sleep(.14)
    print('O')
    time.sleep(.14)
    print('A')
    time.sleep(.14)
    print('D')
    time.sleep(.14)
    print('I')
    time.sleep(.14)
    print('N')
    time.sleep(.14)
    print('G')
    time.sleep(.5)
    loading = False
calltime = True
print("Welcome to The Shelf by WilliamPython1! What would you like to play?")
while calltime == True:
    gamemode = input("8ball, RNG, exit.")
    if gamemode == '8ball' or 'RNG' or 'exit' or 'easteregg':
        #8ball
        if gamemode == '8ball':
            exit8ball = input("Ask a yes or no question to reveal the answer. Type exit to quit.")
            if exit8ball == 'exit':
                print("Thank you for playing.")
                sys.exit()
            randomnum = random.randint(1, 5)
            if randomnum == 1:
                print('Yes.')
                sys.exit()
            elif randomnum == 2:
                print('No.')
                sys.exit()
            elif randomnum == 3:
                print('Please try again.')
                sys.exit()
            elif randomnum == 4:
                print('Maybe. The answer is unclear.')
                sys.exit()
            elif randomnum == 5:
                print("If I told you, I'd Have to kill you.")
                sys.exit()
        #RNG
        elif gamemode == 'RNG':
            numgame = input('Type start to begin the generator. Type exit to quit.')
            if numgame == 'exit':
                print("Thank you for playing.")
            elif numgame == 'start':
                randomnum = random.randint(1, 10)
                if randomnum == 1:
                    quit = input("Your number is 1. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 2:
                    quit = input("Your number is 2. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 3:
                    quit = input("Your number is 3. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 4:
                    quit = input("Your number is 4. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 5:
                    quit = input("Your number is 5. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()        
                elif randomnum == 6:
                    quit = input("Your number is 6. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 7:
                    quit = input("Your number is 7. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 8:
                    quit = input("Your number is 8. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 9:
                    quit = input("Your number is 9. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
                elif randomnum == 10:
                    quit = input("Your number is 10. Type exit to quit.")
                    if quit == 'exit':
                        sys.exit()
        elif gamemode == 'exit':
            print('Thank you for playing.')
            sys.exit()
        elif gamemode == 'easteregg':
            print("This one was kind of obvious, wasn't it?")

4 Answers

+2 votes
answered Sep 30, 2019 by Dave (290 points)
I think this is a good game for a beginner. It would nice if you could add some primitive graphics for the 8-ball and the die inside. AS far as the random #, it would be more fun to have the end user pick a # from 1 - 10 and tell them if there are write or wrong and even create a high-lo game out of it. DAVE
+1 vote
answered Oct 7, 2019 by anonymous

Instead of the massive chain of if statements for randomnum you could do 

for i in range (10):

    if randomnum == i:

    print("Your number is "+ i +". Type to exit")

Or 

print("Your number is" + randomnum +". Type to exit)

if quit == 'exit':
sys.exit()

+1 vote
answered Nov 6, 2019 by Sean Clarke (200 points)
That was actually oddly fun, good work keep it up!
+1 vote
answered Nov 26, 2019 by htr thr (230 points)
this is a realy good game (at least for me cus i don't make games)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...