28th Nov 2023, 10:37 PM
Newer Game
Newer Game - avatar
25 Respuestas
+ 7
The original code was: password = input() if password == password: print("Good Job!") else: print("Try again.") All that needed to be changed was line 2. password = input() if password == "1234": print("Good Job!") else: print("Try again.")
29th Nov 2023, 5:58 AM
Keith
Keith - avatar
+ 6
Abdulrahman ahmed, Gulam Raza, Laguras Xyreel Castromero, Gilbert Aquino This is not a general chat. Please see the community guidelines and start your own topic if you need help or have a coding related question. https://www.sololearn.com/Discuss/3021159/?ref=app
30th Nov 2023, 11:45 AM
Keith
Keith - avatar
+ 5
Solo yes typically if input() == password: <- given that the password is an unknown variable in the test or if we as developers have defined it within our typical structure ... And yes code changes as we discuss causes confusion as we are attempting to talk out what was wrong with the original code as new issues may be being made... Totally agree!
29th Nov 2023, 4:10 AM
BroFar
BroFar - avatar
+ 4
Keith , I use the app on Android, and I also tried to find it in google, but to no avail...ūü§Ē
28th Nov 2023, 11:09 PM
Solo
Solo - avatar
+ 4
Wong Hei Ming just modify the link by adding code. Subdomain to sololearn.com and delete compiler-playground https://code.sololearn.com/cx2ym24wOxdO/?ref=app
29th Nov 2023, 4:28 AM
BroFar
BroFar - avatar
+ 4
The onelink.me links are not sololearn links but a third-party
29th Nov 2023, 4:35 AM
BroFar
BroFar - avatar
+ 4
Abdulrahman ahmed If you need help with an issue, you should start a new topic/thread by going to DISCUSS -> New Post
30th Nov 2023, 10:16 AM
Keith
Keith - avatar
+ 3
BroFar, thank you. But why couldn't I use the suggested link? And this is not the first time...ūü§Ē
29th Nov 2023, 2:07 AM
Solo
Solo - avatar
+ 3
BroFar , Newer Game , I understand that the code is still undergoing changes, which should not be done in the discussion as it is confusing. But from what I see, it is possible to use data entry directly in the condition that the entered password will not be used anywhere else: if input() == "password": print("Good Job!") else: print("Try again.")
29th Nov 2023, 2:19 AM
Solo
Solo - avatar
+ 2
You give a password as input. Then you check if the password you gave is equal to the password itself which is always true. So the code will output always the same result Good job.
28th Nov 2023, 10:51 PM
Black Winter
+ 2
Black Winter, Keith Strange, why do I only see the URL and can't follow this link?...ūü§Ē
28th Nov 2023, 11:01 PM
Solo
Solo - avatar
+ 2
BroFar Almost all the code links open on pc, no matter "compiler-playground" included or not. Links doesn't open on pc are those on "code challenge", or linking to a feed.
29th Nov 2023, 4:33 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
https://www.sololearn.com/discuss/3253969/?ref=app I'm not sure what your orginal version was, but in the current version the problem is that you compare a non-existing variable 'input' instead of your actual variable called 'attempt'. attempt = input() if input == "password": print("Good Job!") else: print("Try again.") You can just change it to: attempt = input() if attempt == "password": print("Good Job!") else: print("Try again.") However, a better approach would be like this: https://code.sololearn.com/cWwg51Vf2t9y/?ref=app This will keep on looping untill correct answer is entered. Note: in the app you can only give input once, so you will get an error at the second time it's waiting for input.
29th Nov 2023, 5:07 AM
J W
+ 2
Newer Game I see that you made some changes but it is still not working. You can delete or comment out the first line and add parentheses to the input function ūüėČ #attempt = input() if input() == "password":
29th Nov 2023, 5:42 AM
Keith
Keith - avatar
+ 1
'If password == password' will always be True so you should change the value to the right of '==' to what you want the password to actually be ūüĒĎ
28th Nov 2023, 10:53 PM
Keith
Keith - avatar
+ 1
Solo Many times the links only seem to work 'in app' ūüėē
28th Nov 2023, 11:04 PM
Keith
Keith - avatar
+ 1
Change the variable captured by the user to something like 'attempt' and use 'if attempt == password:' This will allow you to compare what the user has entered with the saved password. You will need to define the variable 'password' somewhere above that line as well, set to whatever the correct password will be.
28th Nov 2023, 11:06 PM
StuartH
StuartH - avatar
+ 1
Solo When the link doesn't open, try to open it on the web version. Mostly I use the web version unless the link doesn't open on pc, want to mention someone or post a code.
29th Nov 2023, 4:20 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
Its not string
30th Nov 2023, 12:26 AM
Alexander Jr Caparas
Alexander Jr Caparas - avatar