Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
hidden12088ySorry but just from the image it looks like the error could be due to the fact you're trying to convert a string with no numerical values in it into an int, then again maybe you've just deleted something there, but that's what I looks like from here
-
@hidden sorry it actually says print not int, but that is later in the code anyway, I'm just so annoyed I had it working fine as a single game, wanted to add an option to play again and the whole game breaks.
-
hidden12088yWell then that's not the issue, just out of curiosity how are you trying to do it? Did you try making the game a function that's called by an option in a menu that acts as a restart point? (I think that makes sense, my brain is melted tonight after a chemistry A-level paper the day so I apologise if I sort of ramble)
-
@hidden nope, I have while loop with the condition that newGame = 'yes' and then the game is a while loop nested in the first while loop. The only think I did is create a new while loop and move the original into the new one.
-
hidden12088yOh thanks, just seen the screenshot, oh and you don't need to use the int() function, python auto evaluates the input and detects that it's an int when you use input(), you only need int() for the input if you use raw_input()
-
@hidden oh on the tutorial I was following it said to use the int() currently trying to make the code work first though haha
-
hidden12088yAye ^ your man above is right, every line in an IF or ELIF or ELSE statement needs to be indented the same amount so check that and try again☺️
-
hidden12088yOh and by the way since it seems you're just learning it, I would suggest you give codecademy.com a 👀 up, I found them to be pretty helpful when I started off, plus they have a support board thing that directly relates to their tasks so you can get help with any issue on the courses, only downside is their Java course for some reason has a very bad habit of freezing and some of the more complex languages aren't anywhere as near well layed out as the 🐍 course
-
hidden12088yOh for fucks sake, iOS 10 would appear to be a bit over zealous with the changing words to emojis features
-
@hidden yea I've used them before but when I was doing python I was just not motivated by doing it on codeacademy, but with the course I've just done it's taken me a week for the basics and have an advanced course that I'll do soon just gonna get used to the beginners stuff first. Thanks for the help though man.
-
hidden12088yWell whatever works for you lad, as long as you enjoy it and make something deadly with it👊
-
@SoldierPeetaM Python relies on indentation to read code, that's why it has no braces or semicolons. It was thinking that "guess" was outside the if statement.
-
@hidden hey tried taking out the int() it said unorderable types: str() < int() so I do need the int() thanks for trying to help though dude
Related Rants
Coming to the end of beginners python and added a new loop to a number guessing game and now my elif is invalid syntax.
undefined
beginners
loops
elif
python