chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Thread Rating:
  • 0 Vote(s) - 0 Average


[Python Game]Guess The Number filter_list
Author
Message
[Python Game]Guess The Number #1
Code:
import random

title= '''
_____ _     _____ ____  ____    _____  _     _____  
/  __// \ /\/  __// ___\/ ___\  /__ __\/ \ /|/  __/  
| |  _| | |||  \  |    \|    \    / \  | |_|||  \    
| |_//| \_/||  /_ \___ |\___ |    | |  | | |||  /_  
\____\\____/\____\\____/\____/    \_/  \_/ \|\____\  
                                                    
_      _     _      ____  _____ ____                
/ \  /|/ \ /\/ \__/|/  _ \/  __//  __\              
| |\ ||| | ||| |\/||| | //|  \  |  \/|              
| | \||| \_/|| |  ||| |_\\|  /_ |    /              
\_/  \|\____/\_/  \|\____/\____\\_/\_\  


By Psycho_Coder @HackCommunity            
                                                    
'''

def description():
    print '''
The game is simple a random number is chosen by this program everytime and you have to guess it right
If the number is less than what you guessed it will say "Too high guess" else "Too low" and if your
guess is correct then you are the winner.The number will be between 1 and 100 and you will get 5 chances
to guess it correctly
          '''

def getRandomNum():
    return random.randint(1, 100)

def game():    
    count=0
    MAX_NO_OF_GUESS=5
    num=getRandomNum()
    while count<MAX_NO_OF_GUESS:
        count +=1      
        print " Enter Your Guess :"
        guess=input()
        guess=int(guess)
        if guess < num:
            print "You guessed the number too low"
        elif guess > num:
            print "You guessed the number too High"
        else:          
            break;
    
    if guess==num:
        print "Congratulations! You guessed the number correctly."
        print "You Guessed the number correctly in ",str(count)," steps"
    if guess!=num:
        print "Aww! You Ran out of your chances."
        print "The Correct answer would have been :",str(num)        
    

print title
description()
game()

Screenshot

Spoiler:
[Image: b3a1434d-3915-47d9-bd6e-9bcd884b042f.jpg]
[Image: OilyCostlyEwe.gif]

Reply

[Python Game]Guess The Number #2
Code:
import random

title= '''
_____ _     _____ ____  ____    _____  _     _____  
/  __// \ /\/  __// ___\/ ___\  /__ __\/ \ /|/  __/  
| |  _| | |||  \  |    \|    \    / \  | |_|||  \    
| |_//| \_/||  /_ \___ |\___ |    | |  | | |||  /_  
\____\\____/\____\\____/\____/    \_/  \_/ \|\____\  
                                                    
_      _     _      ____  _____ ____                
/ \  /|/ \ /\/ \__/|/  _ \/  __//  __\              
| |\ ||| | ||| |\/||| | //|  \  |  \/|              
| | \||| \_/|| |  ||| |_\\|  /_ |    /              
\_/  \|\____/\_/  \|\____/\____\\_/\_\  


By Psycho_Coder @HackCommunity            
                                                    
'''

def description():
    print '''
The game is simple a random number is chosen by this program everytime and you have to guess it right
If the number is less than what you guessed it will say "Too high guess" else "Too low" and if your
guess is correct then you are the winner.The number will be between 1 and 100 and you will get 5 chances
to guess it correctly
          '''

def getRandomNum():
    return random.randint(1, 100)

def game():    
    count=0
    MAX_NO_OF_GUESS=5
    num=getRandomNum()
    while count<MAX_NO_OF_GUESS:
        count +=1      
        print " Enter Your Guess :"
        guess=input()
        guess=int(guess)
        if guess < num:
            print "You guessed the number too low"
        elif guess > num:
            print "You guessed the number too High"
        else:          
            break;
    
    if guess==num:
        print "Congratulations! You guessed the number correctly."
        print "You Guessed the number correctly in ",str(count)," steps"
    if guess!=num:
        print "Aww! You Ran out of your chances."
        print "The Correct answer would have been :",str(num)        
    

print title
description()
game()

Screenshot

Spoiler:
[Image: b3a1434d-3915-47d9-bd6e-9bcd884b042f.jpg]
[Image: OilyCostlyEwe.gif]

Reply

RE: [Python Game]Guess The Number #3
Nice work, I already made one Tongue
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: [Python Game]Guess The Number #4
Nice work, I already made one Tongue
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: [Python Game]Guess The Number #5
(07-10-2013, 11:18 AM)Ex094 Wrote: Nice work, I already made one Tongue

Since I am a beginner in python so making my way to the top and starting from the basics
[Image: OilyCostlyEwe.gif]

Reply

RE: [Python Game]Guess The Number #6
(07-10-2013, 11:18 AM)Ex094 Wrote: Nice work, I already made one Tongue

Since I am a beginner in python so making my way to the top and starting from the basics
[Image: OilyCostlyEwe.gif]

Reply

RE: [Python Game]Guess The Number #7
(07-10-2013, 11:40 AM)Psycho_Coder Wrote:
(07-10-2013, 11:18 AM)Ex094 Wrote: Nice work, I already made one Tongue

Since I am a beginner in python so making my way to the top and starting from the basics

Agreed! You did pretty well
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: [Python Game]Guess The Number #8
(07-10-2013, 11:40 AM)Psycho_Coder Wrote:
(07-10-2013, 11:18 AM)Ex094 Wrote: Nice work, I already made one Tongue

Since I am a beginner in python so making my way to the top and starting from the basics

Agreed! You did pretty well
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: [Python Game]Guess The Number #9
Nice and simple. Good to do the first steps in a new language.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: [Python Game]Guess The Number #10
Nice and simple. Good to do the first steps in a new language.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply






Users browsing this thread: 1 Guest(s)