I want to make a word contain 3 characters only and no words duplicated
import requests, random
from colorama import Fore
while True:
usr = ""
for charachter in random.choices("abcdefghijklmnopqrstvwxyz1234567890"):
user = usr+ charachter
response = requests.get(f"https://www.instagram.com/{user}/")
if (response.status_code == 200):
print(Fore.RED + "Taken: " + Fore.BLUE + user)
elif(response.status_code == 400):
print(Fore.GREEN + "Avilable User: "+ Fore.BLUE +user)
>Solution :
try this:
import requests, random
from colorama import Fore
while True:
usr = ""
for i in range(3):
while True:
charachter = random.choices("abcdefghijklmnopqrstvwxyz1234567890")
if str(charachter[-1]) not in usr:
usr += str(charachter[-1])
break
response = requests.get(f"https://www.instagram.com/{usr}/")
if (response.status_code == 200):
print(Fore.RED + "Taken: " + Fore.BLUE + usr)
elif(response.status_code == 400):
print(Fore.GREEN + "Avilable User: "+ Fore.BLUE +usr)