Python Giftcard generator Source Code

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Seçkin Üye
Katılım
17 Mar 2020
Mesajlar
298
Tepki puanı
26
Ödüller
5
Yaş
27
6 HİZMET YILI
I was bored and wanted to improve my programming skill so i made a gift card gen. It's just the basic u can change it so u like it.




import random
from progress.bar import Bar
import pyfiglet


letterC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
letterL = "abcdefghijklmnopqrstuvwxyz"
numbers ="0123456789"
codes = []
placeholder = ""
print(pyfiglet.figlet_format("CODE GEN",font="alligator"))
print("\n \r Use ! for Capital Letters and # for numbers")
eingabe = str(input("Enter Your Code Template"))


no_codes = int(input("How many codes do u want?"))
bar = Bar("Generating", max=no_codes)
for x in range(no_codes):
for i in eingabe:
if i == "!":
placeholder += random.choice(letterC)
elif i =="#":
placeholder += random.choice(numbers)
elif i =="-":
placeholder += "-"
if placeholder in codes:
placeholder = ""
else:
codes.append(placeholder)

placeholder = ""

bar.next()
bar.finish()


with open("codes.txt","w") as f:
for item in codes:
f.write("%s\n" % item)
print("Succesfully generated {} codes".format(len(codes)))
input("Press key to exit")
 
Thump up to you
Seçkin Üye
Katılım
31 Ağu 2019
Mesajlar
321
Tepki puanı
28
Ödüller
2
Yaş
37
6 HİZMET YILI
Nice work
 
Seçkin Üye
Katılım
19 Ağu 2019
Mesajlar
500
Çözümler
1
Tepki puanı
30
Ödüller
5
6 HİZMET YILI
keep growing up.
 
Üye
Katılım
4 Nis 2020
Mesajlar
29
Tepki puanı
1
Yaş
27
6 HİZMET YILI
i have a question, where i can use it?
 
Banlı Üye
Katılım
6 Ağu 2019
Mesajlar
289
Tepki puanı
16
6 HİZMET YILI
good luck bro ,i study IT but i can help working for a long time on programming
 
VNBC
Ultra Üye
Katılım
30 Ağu 2018
Mesajlar
1,500
Çözümler
1
Tepki puanı
117
Ödüller
7
7 HİZMET YILI
I have this problem. How to solve this?
1586315922212.png
 
The Looper
Uzman Üye
Katılım
16 Mar 2020
Mesajlar
288
Tepki puanı
23
Yaş
28
6 HİZMET YILI
I was bored and wanted to improve my programming skill so i made a gift card gen. It's just the basic u can change it so u like it.




import random
from progress.bar import Bar
import pyfiglet


letterC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
letterL = "abcdefghijklmnopqrstuvwxyz"
numbers ="0123456789"
codes = []
placeholder = ""
print(pyfiglet.figlet_format("CODE GEN",font="alligator"))
print("\n \r Use ! for Capital Letters and # for numbers")
eingabe = str(input("Enter Your Code Template"))


no_codes = int(input("How many codes do u want?"))
bar = Bar("Generating", max=no_codes)
for x in range(no_codes):
for i in eingabe:
if i == "!":
placeholder += random.choice(letterC)
elif i =="#":
placeholder += random.choice(numbers)
elif i =="-":
placeholder += "-"
if placeholder in codes:
placeholder = ""
else:
codes.append(placeholder)

placeholder = ""

bar.next()
bar.finish()


with open("codes.txt","w") as f:
for item in codes:
f.write("%s\n" % item)
print("Succesfully generated {} codes".format(len(codes)))
input("Press key to exit")
Nice keep it up bro <3 hope you'll get better
 
Onaylı Üye
Katılım
11 Nis 2020
Mesajlar
52
Tepki puanı
6
Yaş
35
6 HİZMET YILI
I see that there's an option of how many codes do you want but I don't see any logic for the certain length for the code in place here. Because from what I am seeing if the code has 6 characters long you're going to have significantly less size then 7 for example. I don't want to run it just for the fear of the txt file size being in the 100's of gigs for a max amount of codes using all three criteria Capital/lowercase/numbers
 
Üye
Katılım
10 Nis 2020
Mesajlar
2
Tepki puanı
0
Yaş
29
6 HİZMET YILI
i have a question
where did you learn python and how you can use it ?
 
Onaylı Üye
Katılım
11 Nis 2020
Mesajlar
51
Tepki puanı
0
Yaş
32
6 HİZMET YILI
How cool that when people are bored, they do this? haha quarantine. but thank you friendly brother yours
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst