Python 3.4 - Strings

Including text in any aspect of your program, text that will appear on the screen, is a string. You can include any kind of text, of course (i.e. The program may ask a user to enter his or her username, etc).

Strings (text) needs to be entered with single or double quotations, you can a do a lot with strings:

https://docs.python.org/2.4/lib/string-methods.html

In your string, if you ever want to make sure some line of text is included just add a backslash (\) to you text. (i.e. 'It\'s important the \'s in it\'s is included all three times actually.')

If you include a backslash and n (\n) it will print the rest of the string on a new line. You can negate this action with an r included here: print(r'hello world') #This will print the raw string.

https://www.youtube.com/watch?v=nefopNkZmB4

Comments

Popular posts from this blog

Python 3.4 - Caesar Cipher

UML - Use Case Diagram