Hello, I'm still very new to programming using Python, just started yesterday.
In this example:
User= "Tuna McFish"
1. What's the code if you just want show 'T McFish'?
2. Also, using print() function, using variable 'user', how to show 'Tuna' then next line is McFish? That looks like this one below:
Thanks! Just exploring each tutorial deeper and very addicting but I got stuck with those two problems. Thanks in advance!
Strings and Slicing
Post a Reply
|Oldest Newest Rating|
· December 1, 2014
Hello Jerry, welcome to the community!
All strings have a number of characters in them, beginning with the number 0, and continuing for the length of the string.
user = "Tuna McFish" has 11 characters. A demonstration of this would be:
Copy and paste the code into a new python program/text editor. If you wish to run an individual section, you can prevent a section of code from running by commenting it out, with a #. The cool thing about python is there are many ways to skin a cat. Have fun with it, and if you want even more practice with python, try codingbat.com. It has fun exercises that can be a little challenging.
This section is all about snakes! Just kidding.
|Bucky Roberts Administrator|