Credit Card Validator | Python Project | Part - 2

Опубликовано: 30 Май 2026
на канале: Aryan Narwal
926
32

#shorts #pythonforbeginners #creditCardValidatorProject
Welcome To Our channel
In this video, you will learn to make credit card validator project using python. It's part-2.
Part - 1 link:    • Credit Card Validator | Python Project | P...  
*************************** code code code *****************************
making a credit card algorithm
part 1
def get_card():
while True:
card = int(input("Enter Card: "))
card_len = len(str(card))
if card_len (greater than symbol) 13 and card_len (less than) 16:
print("Card okay for now.")
break
else:
print("card not in valid length")
continue
return card

making object
print(get_card())

part 2
getting the type of card
if first number
4 - visa
5 - master card
37 - american express
6 - discovery card

def card_type(card):
if card[:1] == "4":
return "visa card"
elif card[:1] == "5":
return "master card"
elif card[:2] == "37":
return "american express card"
elif card[:1] == "6":
return "discovery card"
else:
return "unkown card!!!"

print(card_type(str(get_card())))
***************************** code code code ******************************
So consider Giving a video a like, share it with your friends and Subscribe to our channel too for more videos.
Instagram:   / rohitnarwal7988  
Python book for beginners and intermediate people: https://www.amazon.com/Python-simple-...
Python book for advance topics: https://www.amazon.com/Advance-Python...