Mar-17-2019, 03:27 PM
Your nearly there in your code post #3
Just add
Just add
alphabet[index]
import random alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmopqrstuvwxyz" random_characters = len(alphabet) index = random.randrange(0, random_characters + 1) print(index) print(alphabet[index])A little fancier output
import random alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmopqrstuvwxyz" random_characters = len(alphabet) index = random.randrange(0, random_characters + 1) print(f'Random characters at index <{index}> give output <{alphabet[index]}>')
Output:Random characters at index <3> has result of <D>
Random characters at index <1> give output <B>
Random characters at index <24> give output <Y>