0
I need help
print ("Change the password:") print ("\nâEnter the ancient password:") ancient_password = int(123) print (ancient_password == int(input())) if ancient_password True: print("correct") # I need Help
10 Respostas
+ 7
Hamza El ,
I made some changes to your code...try like this...
https://code.sololearn.com/cQBFKQMvJzm6/?ref=app
+ 5
Hamza El ,
For what you are entering new password ...
In if statement itself we check whether it is true or not...
This line is not needed in else statement...
+ 3
Hamza El try to save the input value to a variable then compare it with your ancient_password with if condition.
EnteredPassword=int(input())
If EnteredPassword is ancient_password:
......
else:
.......
+ 3
Hamza El ,
https://code.sololearn.com/cdFsd8ixzI64/?ref=app
Check this...
+ 2
Riya
please complete this code
https://code.sololearn.com/cuyRLK1FkwI8/?ref=app
+ 1
design issues aside, this line is invalid:
if ancient_password True:
ancient_password is still 123, which is not True in python afaik, so even if you remembered to include an == in that statement it wouldn't work because it'll always be false (and if this were C, 123 *would* evaluate to true so you'd have the opposite problem)
+ 1
print("Change the password:")
ancient_password = "123"
print("Enter the ancient password:")
if ancient_password == input():
print("Correct")
else:
print("Incorrect")
Here is a modified version, if there is something wrong with it, let me know
0
Riya
I want to enter the New password but error
https://code.sololearn.com/cuyRLK1FkwI8/?ref=app
0
probably you'ee running into a limitation of the code bits environment: you can only enter inputs at the beginning, but you can enter multiple inputs on separate lines and it'll take them one at a time.
So give it two numbers at the start when you run it, and it should work.
That said, a) you forgot to convert input to int, and b) "is" is not the same as ==, and will never return true here. "is" asks if they're the same object, which different variables aren't.
0
Donovan Holzhausen-McCarrick
I want to rewrite the second input but it display error
https://code.sololearn.com/cuyRLK1FkwI8/?ref=app