Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code is not working
#1
This code is not working how it is supposed too, any suggestions?

username = "Hello123"
password = "Hello1234"
username_c = input("Please enter your username:\n")
password_c = input("Please enter your password:\n")
while username_c != username and password_c != password:
    print("Welcome!")
    break
    if username_c == username and password_c == password:
        print("You're not who you say you are!")
        username_c = input("Please enter your username:\n")
        password_c = input("Please enter your password:\n")
Reply
#2
Use Code tags as linked in my signature
What is the expected result and what are you getting instead?
Recommended Tutorials:
Reply
#3
How do you tag? Also it is supposed to print 'Welcome' when both username and password match the excpected ones and loop if they don't match but it is saying 'Welcome on any input
Reply
#4
Quote:How do you tag?
Click on the bbcode link under metulburr's post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  code isnt working. nezercat33 1 622 Mar-14-2025, 03:45 AM
Last Post: deanhystad
  Simple code not working properly tmv 2 492 Feb-28-2025, 09:27 PM
Last Post: deanhystad
  I'm new to Python - can someone help with this code as it is not working? lminc123 1 521 Feb-13-2025, 06:13 PM
Last Post: lminc123
  my code is not working erTurko 1 648 Nov-11-2024, 08:43 AM
Last Post: buran
  New to Python - Not sure why this code isn't working - Any help appreciated TheGreatNinx 4 2,316 Jul-22-2023, 10:21 PM
Last Post: Pedroski55
  code not working when executed from flask app ThomasDC 1 3,189 Jul-18-2023, 07:16 AM
Last Post: ThomasDC
  I am new to python and Could someone please explain how this below code is working? kartheekdas 2 1,768 Dec-19-2022, 05:24 PM
Last Post: kartheekdas
Exclamation My code is not working as I expected and I don't know why! Marinho 4 2,175 Oct-13-2022, 08:09 PM
Last Post: deanhystad
  My Code isn't working... End3r 4 3,297 Mar-21-2022, 10:12 AM
Last Post: End3r
  I don't undestand why my code isn't working. RuyCab 2 2,597 Jun-17-2021, 03:06 PM
Last Post: RuyCab

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020