با سلام.

تمرین: تابعی که بررسی کند رمز وارد شده توسط کاربر شامل حروف کوچک و بزرگ و حداقل 8 کاراکتر باشد را بنویسید.

 

def is_strong_password(password):
	has_minimum_length = False
	has_upper = False
	has_lower = False
	has_number = False
	
	minimum_length = 8

	if(len(password) > 8):
		has_minimum_length = True

	for ch in password:
		if(ch >= "A" and ch <= "Z"):
			has_upper = True
		elif(ch >= "a" and ch <= "z" ):
			has_lower = True
		elif(ch >= "0" and ch <= "9"):
			has_number = True

	if(has_minimum_length and has_upper and has_lower and has_number):
		return True

	return False

	#############################
while True:
	password = input("Please enter password: ")
	if(is_strong_password(password)):
		print("this is a good password.")
	else:
		print("this isn't a good password.")

	choice = str(input('Continue?(y/n)')).lower()
	if(choice != 'y'):
		break


 


مشخصات

تبلیغات

محل تبلیغات شما
محل تبلیغات شما محل تبلیغات شما

آخرین وبلاگ ها

برترین جستجو ها

آخرین جستجو ها

Work Lynn کربن فعال Self Development And Moreee سفال سنتر تعمیر جک پالت در استان البرز خريد و فروش ساندويج پانل Mario املاک و صنایع کشاورزی ایران