0
How can i randomly select the character? Currently hard code "b" & "c"
Function: def getLttr(): stringList = list('abcdefghij') shuffle(stringList) return ''.join(stringList) In main: letter = getLttr() num1 = letter.find("b") num2 = letter.find("c")
3 Respostas
+ 4
Are you really needing 2 numbers / indexes back? Can you talk a bit more about what you want to achieve? Thanks!
+ 2
from random import choice
print(choice(['a', 'b'])
0
Yh...
The choice function's best for that..