Skip to content
Menu
Daniel J. Pierce
  • C#
  • Games
  • Graphics
  • Math
  • Python
  • Tynker
  • Unity
Daniel J. Pierce

Guess the Number 2.0

Posted on September 16, 2018November 10, 2019
def main():
    print("What mode do you want?")
    print("peaceful - 12 tries, 1-20")
    print("easy - 10 tries, 1-40")
    print("medium - 8 tries, 1-60")
    print("hard - 6 tries, 1-80")
    print("expert - 4 tries, 1-100")
    print("impossible - 2 tries, 1-150")
    print("custom - You Choose")
    print("random - Random!")
    x = input('mode> ')
    if x == 'peaceful':
        tries = 12
        start = 1
        end = 20
    elif x == 'easy':
        tries = 10
        start = 1
        end = 40
    elif x == 'medium':
        tries = 8
        start = 1
        end = 60
    elif x == 'hard':
        tries = 6
        start = 1
        end = 80
    elif x == 'expert':
        tries = 4
        start = 1
        end = 100
    elif x == 'impossible':
        tries = 2
        start = 1
        end = 150
    elif x == 'custom':
        while True:
            print("How many tries do you their to be?")
            tries = input('tries> ')
            try:
                tries = int(tries)
                if tries < 0:
                    print("Hey, your input is too small")
                    continue
                break
            except:
                print("You have to enter a number")
        while True:
            print("What do you want the start to be")
            start = input('start> ')
            try:
                start = int(start)
                break
            except:
                print("You have to enter a number")
        while True:
            print("What do you want the end of the range to be to be")
            end = input('end> ')
            try:
                end = int(end)
                break
            except:
                print("You have to enter a number")
    elif x == 'random':
        import random
        tries = random.randint(1, 100)
        start = random.randint(-100, 100)
        end = random.randint(start, 100)
        print(str(tries) + " tries")
        print(str(start) + " - " + str(end))
    else:
        print("Hey, " + x + " is not an aviable mode")
        main()
    import random
    x = random.randint(start, end)
    #print(x)
    i = 1
    done = False
    while True:
        print("Geuss #" + str(i))
        try:
            y = int(input('guess> '))
            if y < start:
                print("The number has to be between " + str(start) + " and " + str(end))
                continue
            if y > end:
                print("The number has to be between " + str(start) + " and " + str(end))
                continue
            if y < x:
                print("Too small")
            if y > x:
                print("Too big")
            if y == x:
                print("You got it in " + str(i) + " tries!")
                done = True
        except:
            print("Your input has to be a number")
            continue
        if done == True:
            break
        if i == tries:
            break
        i += 1
    if done == False:
        print("You didn't get it")
        print("The number was " + str(x))
    
import random
title = "Guess the Number"
about = 'Guess the number with many difficulties in a certan numbeer of tries'
game = True

if __name__ == '__main__':
    main()

Projects

  • Procedure Platforming
  • Particle Simulator
  • AP Computer Science Paint Program
  • Maybe Good Platformer
  • Custom Gravity Test
  • Triangle Types
  • Unity Obstacle Course v1
  • Collapsing rows
  • Java Tic Tac Toe (No AI)
  • Mersenne Prime Tester
  • Rainbow
  • Pong
  • Simple Tkinter Calculator
  • Hexidecimal Converter
  • Snake eats apple
  • Protect the Galactic Empire
  • Hangman
  • Beautiful Colorful Thing
  • Four Dots
  • Frogga
  • Escape asteroids
  • Portals
  • Guess the Number 2.0
  • Illogical
  • Tic Tac Toe
  • Guess the Number
  • Ultimate Calculator 1.0.0a0
  • Prime Number Tester
  • Number Base Converter 2.0a0
  • Number Base Converter 1.1
  • Python Equation Calculator
©2025 Daniel J. Pierce | WordPress Theme by Superb WordPress Themes