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 program that receives an email address and separates the various sections as follows and prints on the output example: email: [email protected] info amirhn.ir Example: email: [email protected] username gmail.com
Write a program that receives a number from the user and prints the multiplication table as the following in the output. Yek adad vared konid: 2 x 1 = 2 2 x 2 = 4 x 3 = 6 2 x 4 = 10 x 6 = 12 2 2 x 7 = 14 2 x 7 = 2
Write a function that receives a numeric and if that number was the first number True and otherwise False returned
Write a function that receives the bank card number as an entrance and places * for all its digits except the first and last digits and give some example as the example below: ("603711121119900") "60 ... 60 ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.