Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
guessing script
#1
Hello, this is my first time in python and i need help with my code, i want to guess a number between 1-100, but the problem is i can only guess 1-3times , i want to guess until i get the correct answer, can you help me?

import random

gissat = 0

rätt = random.randint(1, 100)
print("Gissa talet:")

while gissat<rätt:
    gissat = input()
    gissat = int(gissat)

    
    if gissat<rätt:
        print ("För litet!")
   
    if gissat>rätt:
        print ("För stort!")

    if gissat==rätt:
        break
Reply


Messages In This Thread
guessing script - by simon - Oct-09-2016, 08:02 AM
RE: guessing script - by Mekire - Oct-09-2016, 08:21 AM
RE: guessing script - by snippsat - Oct-09-2016, 10:52 AM
RE: guessing script - by simon - Oct-10-2016, 01:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Play again, in a guessing game banidjamali 4 11,790 Jan-22-2021, 06:23 AM
Last Post: banidjamali
  Guessing game with 4 different digits LinseyLogi 6 3,682 Mar-29-2020, 10:49 AM
Last Post: pyzyx3qwerty
  Name guessing game in python Liquid_Ocelot 6 15,049 Apr-01-2017, 12:52 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020