+ 1
How can we generate random alphabets in a single line
Output : aksjskahshsuun
7 odpowiedzi
+ 13
From random import choices
print(''.join(map(chr,choices(range(97,123),k=17))))
print(*map(chr,choices(range(97,123),k=17)),sep='')
+ 12
Thanks Diego , edited 😊
+ 2
You can make a list of all the alphabet numbers, then generate a number between 0 and 25, and then get the index of that number in that list, and you can also repeat it
+ 1
Well i didn't get that Airree
+ 1
Here is a simple one:
import string
import random
for i in range(10): print(random.choice(string.ascii_letters))
+ 1
Mo Hani... but this will print everything in seperate lines....i wnt it all in a single line
+ 1
Someone posted a similar question in StackOverFlow, there are alot of different answers with working codes, check it:
https://stackoverflow.com/questions/2823316/generate-a-random-letter-in-JUMP_LINK__&&__python__&&__JUMP_LINK