Posts

Showing posts from October, 2018

SIMPLE GAME IN PYTHON !!!.....ROLL-GUESSING-GAME

Image
InfoFeed @entrepreneurindianbusiness """this is a simple guessing game...here user guesses the number that comes on rolling the dice...if answer matches,user wins and if user's answer is different then user loses...""" from random import randint from time import sleep def get_user_guess():    guess=int(input("your guess ? "))    return guess def roll_dice(number_of_sides):    first_roll = randint(1,number_of_sides)    second_roll = randint(1,number_of_sides)    max_val = number_of_sides *2    print (("maximum possible value : %d ") % max_val)    guess = get_user_guess()    if guess > max_val:      print ("invalid")    else :      print ("Rolling...")      sleep(3)      print (("first roll :%d")% first_roll)      sleep(3)      print (("second roll : %d")% second_roll)   ...