Thông tin
xóa kí tự s = str(input('Nhập xâu s: ')) c = input() w = s.replace(c,'') print(w) tệp mã nguồn fileName = input("Nhập một tên tệp: ") extensionName = fileName[-2:].lower() if extensionName == "py": print(fileName, "là tệp mã nguồn Python") else: print(fileName, "không phải là tệp mã nguồn Python") TỌA ĐỘ s = input('Dòng lệnh: ') e = s.count('E') w = s.count('W') n = s.count('N') scount = s.count('S') # Đổi tên biến để tránh trùng với xâu s ban đầu x = e - w y = n - scount print('Tọa độ hiện tại của robot: (', x, ',', y, ')') gọi tên bằng TA n = int(input()) print(["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]) MẬT KHẨU import string def checkpassword(password): lengthok = len(password) >= 8 hasupper = any(c.isupper() for c in password) haslower = any(c.islower() for c in password) hasdigit = any(c.isdigit() for c in password) hasspecial = any(c in string.punctuation for c in password) if lengthok and hasupper and haslower and hasdigit and hasspecial: return "Mật khẩu mạnh" else: return "Mật khẩu yếu (Cần ít nhất 8 ký tự, gồm chữ hoa, thường, số và ký tự đặc biệt)" mk = input("Nhập mật khẩu cần kiểm tra: ") print(checkpassword(mk))