Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # String's, we are going to learn more about strings.
- # In python you can use either '' or "" for a string, but let me show you error you can run into.
- # hello = 'Hi this is carl's house' # you may notice that we cannot use a Apostrophe due to useing it to start the string.
- # One wat around it is to use quotation marks to start the string instead.
- hello = "Hi this is carl's"
- # Now to write a new line inside your string you use \n like so.
- hello = "Hello there, today we are learning \n About strings in python"
- # Or we can use tripple quotations which will read all new lines untill you close the string.
- hello = """ Dear Carl,
- I hope you are find, i have just recived your letter.
- i will be booking my flight and returning home soon,
- i hope you get better by the time i arrive home.
- Your sincicly,
- Carl"""
- # Now we can join strings togther like so,
- hello = 'Hi im '
- name = 'Bob '
- how = 'How are you today? '
- sentence = hello+name+how
- print(sentence)
- # Or we can use a comma on one line of a string.
- sentence = 'Hi im', 'bob', 'How are you today?'
- print(sentence)
- # But using the comma method created sentence into a list.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement