I need to square a string, but i am unsure how to do it properly (Python)

  Kiến thức lập trình

I am pretty new to Python and i wanted to do this little script, now the problem is that i theoretically learned the commands but now that i have to make a script i’m a bit confused with all the information

I need to get this string “string = “3,9,13,4,42”” and turn it into this basically “string= “9,81,169,16,1764””

However i need to use the split, append, int, str() and join method apparently

I tried using these things, but i got a bit confused, got a bunch of errors and because i never did this before it was a bit overwhelming for me and i didn’t get to really understand how i am supposed to all of this

I am just going to ask for someone to help me out, i want the answer and i want to know how you guys did it with the stuff i put above.

New contributor

DabtheGreat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT