#๐Ÿ”’ ๐Ÿ”’ help homework.

42 messages ยท Page 1 of 1 (latest)

earnest swallowBOT
#

@rare frigate

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.

rare frigate
#

help xd

fierce jacinth
#

@rare frigate do you see why this is wrong? else: input_password != admin_pass

rare frigate
#

huh

#

so whats the mistake\

#

i did is not equal

#

@fierce jacinth

velvet stratus
#

an if else looks like this

x = 5
if x == 6:
  print("x is 6")
else:
  print("x is not 6")```
#

your else looks like this else: input_password != admin_pass

rare frigate
#

yes but

#

!= means not equal

#

??

fierce jacinth
#

@rare frigate an else can't have a condition. the else block is for when all prior conditions are false.

velvet stratus
#

yeah

rare frigate
#

so if the password the user did is not equal to admin_pass then it will reduce his attempts\

#

i dont see whats wrong

velvet stratus
rare frigate
#

im new to python btw guys

velvet stratus
#

else doenst take anything as an argument

rare frigate
#

so what should i do instead if !=

fierce jacinth
rare frigate
#

but else cant

#

that makes no sense but okay

fierce jacinth
#

exactly

#

it makes tons of sense

#

the "else" is for if the condition is false

#

if you want to check more than one condition, you use elif

rare frigate
#

ok ok fine

fierce jacinth
#
user_input = input('enter some text: ')

if user_input.startswith('a'):
    print('a!!!')
elif user_input.startswith('b'):
    print('b!!!')
else:
    print('neither')
rare frigate
#

thank you guys by thr way!

rare frigate
#

okayyy

#

wait you are right it does make sense

fierce jacinth
#

there's no point doing this, though

user_input = input('enter some text: ')

if user_input.startswith('a'):
    print('a!!!')
elif not user_input.startswith('a'):
    print('no')
#

you could just use else: because if user_input.startswith('a') is false, then not user_input.startswith('a') is guaranteed to be true

#

@rare frigate make sense?

earnest swallowBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.

#

๐Ÿ”’ help homework.

earnest swallowBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.