+ 2
Please help me to get rid of this problem. [Python]
I want to assign a variable with all ascii character(33-126) in a string.I wrote this code but its not work. for i in range(33, 127): a = f'{chr(i), end = ""}' So, can you help me? Please.
4 Answers
+ 5
You're constantly reassingning the value of "a". You should instead add those characters to "a".
a = ""
for i in range(33, 127):
a += chr(i)
+ 5
You can also use a comprehension and the .join() method
a = "".join(chr(i) for i in range (33, 127))
+ 1
Diego Thank you so much.
0
What next should are do at this moment ,