تمرین برنامه نویسی؛ با کدبزن!

منبع جامع سوالات و تمرینات برنامه نویسی

1
+1

ورود با نام کاربری و رمزعبور

Admin آسان 63/ دانلود 3654 بازدید

برنامه ای بنویس که نام کاربری و رمزعبور کاربر رو دریافت کنه و طبق اطلاعات زیر، بررسی کنه که نام کاربری و رمز عبور وارد شده صحیحه یا خیر.


username - password
amirhossein - 12345
hooshang - 009922
manizhe - 00000
mahsa - m11m3


مثال

username: amirhossein
password: 12345
ok


username: amirhossein2
password: 12345
error

47 جواب

نمیتونم این تمرین رو حل کنم!
0
username = input("Enter your username: ")
password = input("Enter your password: ")

usernames_passwords = {
    'amirhossein': '12345',
    'hooshang': '009922',
    'manizhe': '00000',
    'mahsa': 'm11m3'
}

if username in usernames_passwords and usernames_passwords[username] == password:
    print("Login Successful")
else:
    print("Incorrect username or password")
کاربر 2589 دانلود Python جدید
0
username = input('username:')
password = input('password:')
if username == 'amirhossein' and password == '12345'
or
if username == 'hooshang' and password == '009922'
or 
if username == 'manizhe' and password== '00000'
or 
if username == 'mahsa' and password == 'm11m3'
print(ok)
else print(error)
کاربر 1504 دانلود Python جدید
0
user = input("Enter Your User Name: ")
password = input("Enter Your Password: ")

if (user == 'amirhossein' and password == '12345') or \
   (user == 'hooshang' and password == '009922') or \
   (user == 'manizhe' and password == '00000') or \
   (user == 'mahsa' and password == 'm11m3'):
    print("OK")
else:
    print("Error")
Amirhoseyngh447 دانلود Python جدید
10
+1
+1
+1
username = input("Enter your username: ")
password = input("Enter your password: ")

if username == "amirhossein" and password == "12345":
    print("Login successful")
elif username == "hooshang" and password == "009922":
    print("Login successful")
elif username == "manizhe" and password == "00000":
    print("Login successful")
elif username == "mahsa" and password == "m11m3":
    print("Login successful")
else:
    print("Incorrect username or password")
Admin دانلود Python
8
+1
+1
+1
usernames_passwords = {
    'amirhossein': '12345',
    'hooshang': '009922',
    'manizhe': '00000',
    'mahsa': 'm11m3'
}

username = input("Enter your username: ")
password = input("Enter your password: ")

if username in usernames_passwords and usernames_passwords[username] == password:
    print("Login successful")
else:
    print("Incorrect username or password")
Admin دانلود Python
5
+1
+1
+1
username = input("Enter your username: ")
password = input("Enter your password: ")

if (username == "amirhossein" and password == "12345") or \
   (username == "hooshang" and password == "009922") or \
   (username == "manizhe" and password == "00000") or \
   (username == "mahsa" and password == "m11m3"):
    print("Login successful")
else:
    print("Incorrect username or password")
Admin دانلود Python
2
+1
+1
username = input("Enter your username: ")
password = input("Enter your password: ")

if username == "mohaamad" and password== "hj19l9875":
  print("Ok")

elif username == "amirhossein" and password == "12345":
  print("Ok")

elif username == "hooshang" and password == "256437":
  print("Ok")
  
elif username == "manizhe" and password == "nh9087":
  print("Ok")

else:
  print("error")
Mohammad628 دانلود Python
1
+1
u = input("username:")
p =input("password:")
if u == "amirhossein" or p == "12345":
    print("ok,welcame")
else:
    if u == "hooshang" or p == "009922":
        print("ok,welcame")
    else:
        if u == "manizhe" or p == "00000":
          print("ok,welcame")  
        else:
            if u == "mahsa" or p == "m11m3":
                print("ok,welcame") 
            else:
                print("The username or password is incorrect")  
Hossein دانلود Python
1
+1
user = {"amirhossein":"12345",
"hooshang":"009922",
"manizhe":"00000",
"mahsa":"m11m3"}


u = input("username:")
p = input("password:")


if u in user and user[u] == p:
    print("successful")
else:
    print("error")
Afra1919 دانلود Python
1
+1
user_pass = {'amirhossein': '12345', 'hooshang': '009922', 'manizhe': '00000', 'mahsa': 'm11m3' }
a = input('username: ')
b = input('password: ')
if b == user_pass.get(a):
    print('ok')
else:
    print('error')
M3edixd دانلود Python
1
+1
a1 , a2 = 'amirhosein' , '12345'
b1 , b2 = 'hooshang' , '009922'
c1 , c2 = 'manizhe' , '00000'
d1 , d2 = 'mahsa' , 'm11m3'


n = input('nam :' )
p = input('ramz :')


if (n == a1 and p == a2)\
    or (n == b1 and p == b2)\
        or (n == c1 and p == c2)\
            or (n == d1 and p == d2):
                print('vorod ba movafagiyat anjam shod') 

else : print('!vurud namovafag!')
Rtmobin دانلود Python
1
+1
m = input('name:')
n = int(input('age:'))
if m == 'mojtaba' and n ==2009:
     print('welcome')
else:
    print('Password or username is wrong')
Mayoka دانلود Python
1
+1
username = input("username: ")
password = input("password: ")

if (username == "amirhossein" and password == "12345") \
  or (username == "hooshang" and password == "009922") \
  or (username == "manizhe" and password == "00000") \
  or (username == "mahsa" and password == "m11m3") :
  print("ok")
else:
  print("error")
کاربر 1657 دانلود Python
1
+1
Username = input ("enter your name") 
password = input ("enter your password")

if username == ("amirhoseein" ) and  password == ("12345
          print ("login successful")

elif username == "hooshang" and   password == ("009922")
           print ("login successful")

elif username == ("manizhe") and password ==("00000")
         print ("login successful")

elif username ("mahsa") and password == ("m11m3")
          print ("login successful")

print ("incorrect username or password")
Amirreza دانلود Python
0
username = input("enter your username: ")
password = input("enter your password: ")
if username == "amirhossein" and password == "12345":
  print("ok")
elif username == "hooshang" and password == "009922":
  print("ok")
elif username == "manizhe" and password == "00000":
  print("ok")
elif username == "mahsa" and password == "m11m3":
  print("ok")
else:
  print("error") 
Aryan84 دانلود Python
0
user = input('Username : ')
password = (input('Password : '))

if user == 'amirhossein' and password == '12345':
    print('Correct')
elif user == 'hooshang' and password == '009922':
    print('Correct')
elif user == 'manizhe' and password == '00000':
    print('Correct')
elif user == 'mahsa' and password == 'm11m3':
    print('Correct')
else:
    print('User or password is incorrect.') 
Naaji دانلود Python
0
a=input('username :')
b=input('password :')
if a=='amirhossein' and b=='12345' :
    Print('ok')
elif a=='hooshang' and b== '009922' :
    Print('ok')
elif a=='manizhe' and b=='0000' :
    Print('ok')
elif a=='mahsa' and b=='m11m3' :
    Print('ok')
else :
    Print('username or password is incorrect :/ ') 
Mla23 دانلود Python
0
username = input('Please Enter Your Username: ')
password = input('Please Enter Your Password: ')


userpass = ['amirhossein','hooshang','manizhe','mahsa']
passwordpass = ['12345','009922','00000','m11m3']


if username==userpass[0] and password==passwordpass[0]:
    print('OK')
elif username==userpass[1] and password==passwordpass[1]:
    print('OK')
elif username==userpass[2] and password==passwordpass[2]:
    print('OK')
elif username==userpass[3] and password==passwordpass[3]:
    print('ok')
else:
    print('error')
Kianoosh2002 دانلود Python
0
user= input ('whats user name:')
password = input('whats password: ')

if user or password == ('amirhossein' and int('12345')):
  print(True)
elif user or password == ('hooshang' and int('009922')):
  print(True)
elif user or password == ('manizhe' and int('00000')):
  print(True)
elif user or password == ('mahsa' and int('m11m3')):
  print(True)
else:
  print(False) 
4t3in دانلود Python
0
username1=("amirhossein")
password1=("12345")

username2=("hooshang")
password2=("009922")

username3=("manizhe")
password3=("00000")

username4=("mahsa")
password4=("m11m3")

a=input("enter username: ")
b=input("enter password: ")
if a == username1 and b == password1 :
  print("welcome to account")
elif a == username2 and b == password2 :
  print("welcome to account")
elif a == username3 and b == password3 :
  print("welcome to account")
elif a == username4 and b == password4 :
  print ("welcome to account")
else:
  print("error")
Miladkhan دانلود Python
0
USERS ={"amirhossein" : "12345" , "hooshang" : "009922" , "manizhe" : "00000" , "mahsa" : "m11m3"}
def voorod(username , password):
  if username in USERS and password == USERS[username]:
    return "ok"
  return "error"

username = input("enter username: ")
password = input("enter password: ")
print(voorod(username , password))
Aryan84 دانلود Python
0
def voorod(username , password):
  if username == "amirhossein" and password == "12345":
    return "You have successfully logged in"
  elif username == "hooshang" and password == "009922" :
    return "You have successfully logged in"
  elif username == "manizhe" and password == "00000":
    return "You have successfully logged in"
  elif username == "mahsa" and password == "m11m3":
    return "You have successfully logged in"
  return "your username or password is wrong"

username = input("enter username: ")
password = (input("enter password: "))
print(voorod(username , password))
Aryan84 دانلود Python
0
user_name=input('user_name')
password=input('password')
if user_name='amirhossein' and password='12345'\
    or user_name='hooshang' and password='009922'\
    or user_name='manizhe' and password='00000'\
    or user_name='mahsa' and password='m11m03':
    print('ok)
else:
     print('error')
Zb8319 دانلود Python
0
username= int(input("enter the username : "))
password= int(input("Enter the password : "))


if username == 1234 and password == 1234 :
 print("welcome hossein")
 
elif username ==3434 and password==3434:
 print("welcome mohamad")
elif username != password :
 print("error")

کاربر 308 دانلود Python
0
username = input("username: ")
password = input("password: ")


if username == "amirhossein" and password == "12345":
    print("ok")
elif username == "mahsa" and password == "m11m3":
    print("error")
else:
    print("errore")

کاربر 447 دانلود Python
0
user = input ( "enter your user name :")
password = ( input ("enter your password "))


if user == "amirhosein" and password == "12345" :
    print (" wellcom amir hosein ")


elif user == "hooshang" and password == "0099222" :
    print ("wellcom hooshang ")


elif user == "manizhe" and password == "00000" :
    print ("wellcom manizhe ")


elif user == "mahsa" and password == "m11m3" :
    print ("wellcom mahsa")
    
else :
    print (" your password or username is not correct try agane")
کاربر 499 دانلود Python
0
i = input("name: ")
n = input("pasword: ")


l = 'manizhe' 
d = '00000'


u = 'amirhossein' 
f = '12345'


j = 'hooshang'
p = '009922'


k = 'mahsa'
o = 'm11m3'


if i == l and n == d:
    print("Login successful")
elif i == u and n == f:
    print("Login successful")
elif i == j and n == p:
    print("Login successful")
elif i == k and n == o:
    print("Login successful")
else :
     print("Incorrect username or password")
Amirhossinegoldoust دانلود Python
0
d={"amirhossein":'12345',"hooshang":'009922','manizhe':'00000','mahsa':'m11m3'}
username=input("username: ")
password=input("password: ")
if username in d and d[username]== password :
    print("ok")
else:
    print("error")
Mahan78 دانلود Python
0
username = input("username: ")
password = input("password: ")
      
if (username == "amirhossein" and password == "12345") \
    or (username == "hooshang" and password == "009922") \
    or (username == "manizhe" and password == "00000") \
    or (username == "mahsa" and password == "m11m3") :
    print ("welcome") 

else: 
    print ("please try again")
کاربر 540 دانلود Python
0
username = input('username: ')
password = input("password: ")

print("username"'password')
کاربر 659 دانلود Python
0
def login():
    username = input("نام کاربری: ")
    password = input("رمزعبور: ")

    if username == "amirhossein" and password == "12345":
        print("ورود موفقیت آمیز")
    elif username == "hooshang" and password == "009922":
        print("ورود موفقیت آمیز")
    elif username == "manizhe" and password == "00000":
        print("ورود موفقیت آمیز")
    elif username == "mahsa" and password == "m11m3":
        print("ورود موفقیت آمیز")
    else:
        print("نام کاربری یا رمزعبور اشتباه است")

login()
Abtin67 دانلود Python
0
a = input(" username:")
b = input("username:")
if a == "amir" and b == "009922" or a == "hoshang" and b == "12345" or a ==" mahsha" and b == "m11m3":
    print("ok")
Negar دانلود Python
0
username = input("UserName :")
password = input("Password :")

list_name = ["amirhossein", "hooshang", "manizhe", "mahsa"]
list_password = ["12345", "009922", "00000", "m11m3"]
zip_lists = dict(zip(list_name, list_password))

if username in zip_lists and password == zip_lists[username]:
    print("ok!")
else:
    print("error!")
کاربر 613 دانلود Python
0
User = input("Username : ")
Pas = input("Password : ")
if User == "amirhosein" and Pas == "12345":
    print(" ==> Correct ! ")
elif User == "hooshang" and Pas == "0992":
    print(" ==> Correct ! ")
elif User == "manizhe" and Pas == "00000":
    print(" ==> Correct ! ")
elif User == "mahsa" and Pas == "m11m3":
    print(" ==> Correct ! ")
else:
    print(" ==> Incorrect ! ")
quit = input("Press ENTER to close")
Pooria08 دانلود Python
0
a= input ('user= ')
b= input ('pass= ')
u1 , u2 , u3 , u4 = 'mitra' , 'saly' , 'sedna' , 'afran'
p1 , p2 , p3 , p4 = '12a34' , '43S21' , '45@67' , '7w6E5$4'
if a == u1 and b == p1 :
    print ('OK')
elif a == u2 and b == p2 :
        print ('OK')
elif a == u3 and b == p3 :
        print ('OK')
elif a == u4 and b == p4 :
        print ('OK')
else :
           print ('ERROR')
کاربر 1714 دانلود Python
0
a=input('username: ')
b=input('password: ')
user1='amirhossein'
pass1='12345'
user2='hooshang'
pass2='009922'
user3='manizhe'
pass3='00000'
user4='mahsa'
pass4='m11m3'
if a== user1 and b==pass1 or a==user2 and b==pass2 or a==user3 and b==pass3 or a==user4 and b==pass4:
    print('true')
else:
    print("eroor")
کاربر 1910 دانلود Python
0
a=str(input("enter your username: "))
b=str(input("enter your password: "))

if a== "amirhossein" and b== "12345":
    print("welcome {}".format(a))
elif a== "manizhe" and b== "00000":
    print("welcome {}".format(a))
elif a== "mahsa" and b=="m11m3":
    print("welcome {}".format(a))
elif a== "hooshang" and b== "009922":
    print("welcome {}".format(a))
else:
    print("error❌")
Asgaryam دانلود Python
0
u = input("username:")
p = input("passworord:")


if "amirhossein"==u and "12345"==p :
    print( "u:{} p:{} ok".format(u ,p))
elif "hooshang"==u and "009922"==p :
    print( "u:{} p:{} ok".format(u ,p))
elif "manizhe"==u and "00000"==p:
    print( "u:{} p:{} ok".format(u ,p))
elif 'mahsa'==u and "m11m3"==p:
    print( "u:{} p:{} ok".format(u ,p))
elif 'admin'==u and "99999"==p:
    print( "u:{} p:{} ok".format(u ,p))
else:
    print("""username:{}
passworord:{}
username - password It is wrong""".format(u ,p))    
    
کاربر 2019 دانلود Python
0
def check_data(list_user_name,list_password1):
    enter=input('enter user name: ')
    enter_pass=int(input('enter pass word: '))
    if enter in list_user_name and enter_pass in list_password:
        natije='you can log in '
    else:
        natije='check the user name and pass word'
    return natije
enter=0
list_user_name=[]
list_password=[]
enter=input('enter user name : ')
pass_word=int(input('enter user password: '))
conti=0
while conti!='fin':
    list_user_name.append(enter)
    list_password.append(pass_word)
    enter=input('enter user name : ')
    pass_word=int(input('enter user password: '))
    conti=input('enter fin to finish programe')
next_l=input('enter 1.to log in 2. for end')
if next_l=='1':
    print(check_data(list_user_name,list_password))
else:
    print('good by...')
Knowledgebiome دانلود Python
0
users={
    'amirhossein' : '12345',
    'hooshang' : '009922',
    'manizhe' : '90000',
     'mahsa' : 'm11m3'
     }
     
     
username=input('username : ')
password=input('password : ')


if (username in users) and (password==users[username]):
    print('welcome')
else:
    print('wrong username or password , try again')

Soheyl دانلود Python
0
# یک دیکشنری حاوی اسامی و پسورد ها
User_information = {
  "amirhossein": "12345",
  "hooshang": "009922",
  "manizhe": "00000",
  "mahsa": "m11m3"
}

# دریافت نام کاربر و پسورد
user_name = input("enter user name : ")
password = input("enter password : ")

# بررسی وجود و عدم وجود نام کاربری و عدم همخوانی آنها با هم 
if user_name in User_information and password == User_information[user_name]:
  print("Login was successful.")
else:
  print("The username or password is incorrect")
کاربر 2226 دانلود Python
0
x = username = (input ("username:"))
y = password = (input ("password:"))
if x == "amirhossein" and y == "12345":
    print("wellcome " + x)
elif x == "hooshang" and y == "009922":
    print("wellcome " + x)
elif x == "manizhe" and y == "00000":
    print("wellcome " + x)
elif x == "mahsa" and y == "m11m3":
    print("wellcome " + x)
else:
    print("error") 
Mohisara321 دانلود Python
0
a = input('nam karbari ra vared konid : ')
b = input('ramz ro vared konid : ' )
if a == 'admin' and b == '123' :
    print('doroste')
else : 
    print ('dorost nist !')
Mahdiyar دانلود Python
0
myusers = {
"amirhossein": "12345",
"hooshang" :"009922",
"manizhe" :"00000",
"mahsa" : "m11m3"


}
i = 0
entereduser = "  "
enteredpass = "  "



while entereduser not in myusers or myusers[entereduser] != enteredpass:
     i=i+1
     if i>3:
      break
     entereduser = input("  please enter username  : ")
     enteredpass = input("  please enter password : ") 
    
if i < 3:
   
 print("ok")
else:
  print("error")
    
    


 
Hbt6384 دانلود Python
0
#This program can help you in check your account or add it .
# برای تمرین بالا لازم است که نام ها را در یسرنمس و لیست نام و رمز غبور را در نمس وارد کنید
# under this line
names=[]
usernames=[]
while True:
    answer=input('Are you registired?')
    if answer=='yes':
        username=str(input('username: '))
        Password=str(input('Password: '))
        user=[username,Password]
        find1=False
        for i in names:
            if i==user:
                find1=True
        if find1==True:
            print('Welcome')
        else:
            find2=False
            for i in usernames:
                if i==username:
                    find2=True
            if find2==True:
                print('Password is false')
            else:
                print('we don not have this username.')
    if answer=='no':
        username=str(input('username: '))
        run1=False
        run2=False
        again=False
        while run1!=True:
            safe1=len(username)
            if safe1<4:
                print('username should be greater from 3 litters.')
                username=str(input('username: '))
            else:
                run1=True
        Password=str(input('Password: '))
        while run2!=True:
            safe2=len(Password)
            if safe2<8:
                print('Password is not safe.')
                Password=str(input('Password: '))
            else:
                run2=True
        while again!=True:
            for i in usernames:
                if i==username:
                    print('another person used it .')
                    username=str(input('username:'))
            else:
                safe3=len(username)
                if safe3<4:
                    print('Username should be greater from 3 litters.')
                    username=str(input('username: '))
                else:
                    again=True
        print('Welcome to our family!')
        user=[username,Password]
        usernames.append(username)
        names.append(user)
کاربر 2491 دانلود Python
0
username = (input("You need a username to log in"))
password = (input("A password is required to enter the user account"))


if username == " sadra":
    print("ok")
if password == " 8520":
    print(username)
    print(password)
کاربر 1777 دانلود Python
0
username = input("Enter your username: ")
password = input("Enter your password: ")

usernames_passwords = {
    'amirhossein': '12345',
    'hooshang': '009922',
    'manizhe': '00000',
    'mahsa': 'm11m3'
}

if username in usernames_passwords and usernames_passwords[username] == password:
    print("Login Successful")
else:
    print("Incorrect username or password")
Mahdid7 دانلود Python

ارسال جواب

/* کداتو توی این بخش بنویس
فرقی نمیکنه چه زبان برنامه نویسی باشه، همرو پشتیبانی میکنیم :)
البته قبلش این سه خط رو پاک کن */

  • تو جوابت میتونی از تصویر، کد، لینک به سایر صفحات و... استفاده کنی
  • لطفا جواب های تکراری ارسال نکن
  • جواب های ارسالی، پس از بررسی کوتاهی، ویرایش میشن و در سایت نمایش داده میشن
  • ارسال جواب حق مادی یا معنوی برای ارسال کننده ایجاد نمیکند و تمام حقوق برای سایت کدبزن محفوظ است

تمرینات مرتبط

تشخیص با استفاده از هوش مصنوعی
×
×
بستن