+ 3

Did I do something wrong?

print ("Whats your name?") user_name = input() if user_name == "Albert": print ("<Dang> You") elif user_name == "Mark": print ("Whats up,Mark?") else: print ("Hello," + user_name + "!Have a nice day") I made this code in python it worked I made some modifications and now when I put the input "Albert" it doesn't do what is supposed to

17th Sep 2019, 8:43 PM
mute .so.toxic
mute .so.toxic - avatar
14 ответов
+ 1
I thinks what's wrong in your code is the indentation, there are 2 tabs there If user_name == "Albert": print("...") Good day man !
19th Sep 2019, 12:58 PM
Michael Toninger
+ 3
print("Whats your name?") user_name = input() if user_name == "Albert": print("I love you!") elif user_name == "Mark": print("Whats up, Mark?") else: print("Hello, " + user_name + "! Have a nice day") #does this code do what you want?
17th Sep 2019, 8:52 PM
Anton Böhler
Anton Böhler - avatar
+ 3
Potato Squad my auto correct <kindly and mistakenly messes> me over every time
17th Sep 2019, 9:04 PM
mute .so.toxic
mute .so.toxic - avatar
+ 2
I changed the indentation in the code, it's really important in python, test it 🙃
17th Sep 2019, 8:55 PM
Anton Böhler
Anton Böhler - avatar
+ 2
do you input "Albert" or "Albert "? (yes there is a big diffrence)
17th Sep 2019, 8:57 PM
Anton Böhler
Anton Böhler - avatar
+ 2
Anton Böhler looks like my phone was auto completing my input and putting a space after it
17th Sep 2019, 9:01 PM
mute .so.toxic
mute .so.toxic - avatar
+ 2
https://code.sololearn.com/c7pnSpRFZEEZ/?ref=app Work for me Please check if you use first capital letter.
17th Sep 2019, 9:01 PM
Potato Squad
Potato Squad - avatar
+ 2
Lol Faisal
18th Sep 2019, 5:14 AM
Trigger
Trigger - avatar
+ 2
Hi, first sorry by my poor English... It isn't my first language... It is spanish... I have not problem with your program.... I think that you put "albert" and if you pay attention in your sentences "if" you put Albert.... So the problem is that albert != Albert because one have uppercase and other lowercase. Both are not equals
19th Sep 2019, 3:26 AM
Agustin
Agustin - avatar
17th Sep 2019, 8:53 PM
mute .so.toxic
mute .so.toxic - avatar
+ 1
Anton Böhler still gives me the answer "Hello,Albert ! Have a nice day"
17th Sep 2019, 8:56 PM
mute .so.toxic
mute .so.toxic - avatar
+ 1
"Albert" Anton Böhler
17th Sep 2019, 8:58 PM
mute .so.toxic
mute .so.toxic - avatar
+ 1
well that doesn't make sense ... for me it works when i input "Albert" 🤷‍♂️
17th Sep 2019, 9:01 PM
Anton Böhler
Anton Böhler - avatar
+ 1
Potato Squad I said in a comment what I did wrong
17th Sep 2019, 9:04 PM
mute .so.toxic
mute .so.toxic - avatar