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 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
class Word: def __init__(self, number): self.number = number def mask_card_number(self): if len(self.number) < 12: return "شماره کارت باید حداقل ۱۲ رقم باشد." return self.number[:4] + '*' * (len(self.number) - 8) + self.number[-4:] card_number = input("enter the number: ") obj = Word(card_number) print(obj.mask_card_number())
Submitting answers is currently unavailable.
Write a program that receives 2 numeric value from the input and stores in variables A and B. Then move the values of these two variables (the value of variable A is to be stored within B and the value of variable B is saved within a)
Write a function that receives a string and returns the number of letters: To solve this question, you should not use ready-made functions for example: get_len ('code-bezan.ir') # 13
1- The user selects a number from 0 to 100 in his mind 2- The program guesss the user's desired number 3- The user according to the guessing number is one of the options (the correct guess, the number is larger, the number ... Moore ...
We want to open the cow door, we don't know the password, but we have the following information: the second -digit safing password and the fifth digit equivalent to the first number of the first digit of a larger unit ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.