Okey, it's an indentation bug

What the hell is going with my code?!!
https://replit.com/@khdyjhlqsmy/day-1100-days?s=app

My code

print("Gissing number from 80 to 100")
while True:
    print()
    number = int(input("What's your guss? "))
    
  if number == > 100 
   print("too low, try again ")
    
  elif number == < 100 
   print("too high,try again")
    
  elif number == 100 
    print ("Good job your guss is righ")

  else :
    print ("Deeemn, goob bay")
    exit()

Hi, @khdyjhlqsmy!
Are the if statements inside of the while loop? If so, the if statements do not match the indentation of

print()
number = int(input("What's your guss? "))
3 Likes
print("Gissing number from 80 to 100")
while True:
  print()
  number = int(input("What’s your guss? "))

  if number => 100:
    print("too low, try again")

  elif number =< 100:
    print("too high,try again")

  elif number == 100:
    print ("Good job your guss is righ")

  else:
    print ("Deeemn, goob bay")
    exit()
1 Like

@SnakeyKing:
While it is good to give the correct code to the OP, it is better to nudge them in the right direction rather than just giving OP the answer so that they will learn their lesson and learn to not make the same mistake in future programs.

3 Likes

@khdyjhlqsmy please unmark @joecooldoo’s answer if your problem is not fixed.

Hey there, please be mindful of your language in this forum and please do not post the same topic to multiple categories.

2 Likes

Question:
What is wrong with indentation???

Repl link:

https://replit.com/@khdyjhlqsmy/day-1100-days?s=app
code snippet :

print("Gissing number from 80 to 100")
while True:
    print()
    number = int(input("What's your guss? "))
    
  if number  => 100 :
   print("too low, try again ")
    
  elif number =< 100 :
   print("too high,try again")
    
  elif number == 100 :
    print ("Good job your guss is righ")

  else :
    print ("Deeemn, goob bay")
    exit()

Instead of => and =<, you should have >= and <=, that should be all :slight_smile:

2 Likes

I’ve done it and it still doesn’t work

@khdyjhlqsmy please do not break the Guidelines by posting a topic that already exist.

Hi @khdyjhlqsmy ! If you didn’t edit the indent settings, you can click the TAB key to undent 1 level, or 2 spaces.

2 Likes

@khdyjhlqsmy I found your problem, your print() and number =, are indented too far. Try this:

print("Gissing number from 80 to 100")
while True:
  print()
  number = int(input("What's your guss? "))
    
  if number  => 100 :
   print("too low, try again ")
    
  elif number =< 100 :
   print("too high,try again")
    
  elif number == 100 :
    print ("Good job your guss is righ")

  else :
    print ("Deeemn, goob bay")
    exit()
1 Like

The logic is kinda wrong too?

Or this is just a joke and it flew by me like a plane?

1 Like

that code will never run

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.