2
Sorry if my question seems silly I’m still novice but it’s the following, I created a python function that should return me a list with this character in "~". Here is the function:
def escreva(texto):
lista = []
cont = 0
while cont < len(texto)
lista = ['~']
cont += 1
a = str(input('Entre com o texto'))
print(a)
print(escreva(a))
I want this list to be the size of the text that was typed only when I run the program it shows me the typed string and the word None :
String (O texto qualquer que eu digitei e mandei printar)
None
I wonder why it returns me the word None and how could I make this list look the size of the text.
Could also use list comprehension
return ["~" for _ in texto]
or even (if you don’t need to check any value) simplyreturn ["~"] * len(text)
– luigibertaco
Yeah, but I followed his logic :)
– gato