How can i save an output of a for loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i save an output of a for loop?

import random import string #variables a = string.ascii_lowercase result = [] TranslatedText = str(input("Enter the text you want to translate: ")) print(TranslatedText) for i in range(2): x = print(random.choice(a)) result.append(str(x)) print(result) output is ["None", "None"] i want the output to be the 2 random letters from the loop but idk how to do that.

14th Mar 2019, 3:26 PM
Jordi
Jordi - avatar
1 Answer
+ 1
You can see the corrected code. Hope it helps you. https://code.sololearn.com/cIhmT1kEljeL/?ref=app
14th Mar 2019, 3:43 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar