Hide the card number.
Write a function that receives a bank card number as an entrance and places * for all its digits except the first and last 4 digits and gives a value as the example below.
Example:
("6037111122119900") ➞ "6037 ******** 9900"
Write a function that receives a bank card number as an entrance and places * for all its digits except the first and last 4 digits and gives a value as the example below.
Example:
("6037111122119900") ➞ "6037 ******** 9900"
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
def shomare(kart): if len(kart) == "16": return "shomare kart ma bayad 16 ragham bashad" frist = kart[:4] last = kart[-4:] part = "*" * len(kart) return f"{frist}{part}{last}" print(shomare(kart=str(input("enter your number:"))))
x = input("enter number cart:") if len(x) > 16 : print("number too long") elif len(x) < 16 : print("number too short") else: print(x[:5] + "*" * 6 + x[11:])
def hide_number(card):
return card[0:4]+'*'*8+card[12:16]
card = input('Enter your card number : ')
print(hide_number(card))
def card(number_card): if len(number_card) == 16 : print(number_card[:4] + ("*" * 8) + number_card[-4:]) else : card(input("error..., No, please enter a 16-digit number : ")) number_card = input("Enter number card (16) : ") card(number_card)
def card_number_loop(num): if len(num) < 16: return "card_num At least 16 Digit" number="" for i in range(len(num)): if i < 4 or i >= len(num) - 4: number+=num[i] else: number+='*' return number card_num=input("card_num: ") num=card_number_loop(card_num) print(num)
def Cart(n) :
x = n[0 : 4] + "********" + n[12 : 16]
return x
print(Cart(input()))
def mask_card_number(card_number): """ Masking the middle digits of a bank card number Arguments: card_number: Bank card number as a string Return value: A string containing the masked card number """ if len(card_number) < 4: return "The card number is invalid." masked_number = card_number[:4] + "*" * (len(card_number) - 6) + card_number[-4:] return masked_number # Usage example: card_number =(input("Enter card Number: ")) masked_card = mask_card_number(card_number) print(masked_card) #Output: 1234********3456
Submitting answers is currently unavailable.
Write a function that receives a list (array) as a parameter, and deletes its duplicate items and returns the new (array) list
Parking Management Program Write: When arriving, arrival time and car license plate number stored when exit, exit time save for the desired car at any moment (in the parking lot, exit) and other information ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.