0
I am writing a program but cannot get the second line of code to activate.
s = input('Please enter username: ') print(s) Sovietwomble = 2 sovietwomble = 2 if 2==2: print('<redacted>!') else: print('You are slaves under the currylord!')
19 Antworten
+ 13
Try it like this:
username = input('Please enter username: ').lower()
print(username)
if username == 'sovietwomble':
print('Stuff')
else:
print('Other stuff')
+ 12
Question: who/what are Sovietwomble and the Currylord?
+ 9
wait are you trying to have the user enter the value for sovietwomble
+ 9
the code would be:
s = input()
if s == "Sovietwomble" or s == "sovietwomble":
# womble is faggot code
else:
# currylord code
+ 9
I think you completely misunderstood variables. id suggest you to go through the course again
+ 9
@Kolby in the last code you posted theres just a : missing after the line
+ 8
do you mean the print(s) or the thing in the else?
+ 8
that doesnt execute because the if statement 2==2 is true. else only executes if the corresponding if didnt execute
+ 8
instead of checking if 2==2, check if Sovietwomble==sovietwomble
+ 4
Man, why would you ever want to run this? ;)
Try thinking of a real logic condition that might be False or True, depending on the value of s (the user input).
2==2 will always be True
+ 3
if s=='Sovietwomble':
(rest of code)
* I never thought I'd write this :)
+ 3
Lose the variables.
Enter "if s.lower() == 'sovietwomble':"
+ 1
What i am trying to do is if they enter Sovietwomble it prints "womble is a faggot". But if they enter anything else it prints "you are all slaves under the curry lord"
+ 1
Yeah realized that
0
The thing in else
0
Ok but what do i need to do to execute it if i do not enter S/sovietwomble
0
But i do not enter sovietwomble it still prints "Womble is a faggot."
0
I use two versions in case if they hypothetically write sovietwomble instead of Sovietwomble.
0
Thank you. I will do so.