Help me with this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Help me with this code

I want to make a number guesser app when I type e.x 62 it's says "put higher" this is wrong please help!!!!!!!!! #play it and then see the code s = int(input("put a number between 1-100:\n")) #to ask user for a number print ("you put",s)#to show to the user what #he/she puts if s == 47: #to configure the right number print ("correct") else: if s >=1 & s <47: print ("put higher") else: if s >47 & s <=100: print ("put lower") what I do wrong?

30th Mar 2017, 5:32 PM
Shredder
Shredder - avatar
3 Answers
+ 7
You definitely have to correct indentation. Also, you should change & to and, as & is a bitwise operator and might produce funny results. I put 56 as input and it told me to bid higher :) The rest seems okay, it should work properly.
30th Mar 2017, 6:51 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
Try to replace "else: if" to "elif".
30th Mar 2017, 5:39 PM
Maz
Maz - avatar
- 1
thanks so much!!
30th Mar 2017, 7:56 PM
Shredder
Shredder - avatar