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

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

0

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

Admin آسان 63/ 1712 بازدید

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


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


مثال

username: amirhossein
password: 12345
ok


username: amirhossein2
password: 12345
error

31 جواب

نمیتونم این تمرین رو حل کنم!
6
+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":
    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
3
+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
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
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
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")
کاربر 481 دانلود 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
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 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
-1
-1
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
-1
-1
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
-1
-1
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
-1
-1
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
-1
-1
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
-1
-1
username = input('username: ')
password = input("password: ")

print("username"'password')
کاربر 659 دانلود Python

ارسال جواب

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


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

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

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