#๐Ÿ”’ New to python

15 messages ยท Page 1 of 1 (latest)

hazy sequoia
night thunderBOT
#

@hazy sequoia

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hazy sequoia
#

I have no idea why it looks like that on dark mode

#

If anyone joins, use the link

fickle crystal
#

You're using Python 2, which has been deprecated for a while

#

Any reason why you're using Trinket ?

hazy sequoia
#

Its finished homework and they make us use that.

hazy sequoia
dull sequoia
#

instead of using codeABCDbool for the while loop, you could use attemptsRemaining to check if you have to loop again

#
if codeAbool and codeBbool and codeCbool and codeDbool == True:

this code will work, but probably doesn't do what you think it does. those elements of the if statement are individually resolved as essentially:

if (codeAbool) and (codeBbool) and (codeCbool) and (codeDbool == True):

This still works because a bool on its own is checked if it's true or not in if statements, but what i think you expected this to do is equate true to every individual elements. if you want to do that in the future, you'll have to check each individually or use a loop to check if they are all true

#

I'm not sure if comprehensions are in py2, but in py3 you can do
all(code == True for code in (codeAbool, codeBbool, codeCbool, codeDbool)
which will check if all of them equal True (which, == True is still unnecessary, you could do code aswell in this case)

#

correct me if I'm wrong, but I dont see you use codeList anywhere

night thunderBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.