If I type in the letter PYthon, I want to make the result come out like pyTHON
Here's the result What should I do?python
For Python, indentation is very important. Because it's the grammar of this language in itself. It means that if you tap a few times less, or if you only have a few spaces left, the content of the code may change completely.
In the code of the text, there was no meaning to use the while sentence, and the conditional sentence below is also supposed to change the entire original string, not each letter, so it doesn't seem to work as intended.
Also, since Python's output statement is essentially followed by an opening (\n), you should give an end value to prevent it from being opened.
I wrote it in a relatively desirable way, so please interpret it slowly one by one.
I thought I could make the lower part more efficiently, so I made it using the for statement as a reference. There's a way like this, so I think it'll be good if you take it as that.
~~Maybe~~You can see the code written more intuitively.
© 2022 pinfo. All rights reserved.