pythoncrushcourse
pythoncrushcourse
Strings
A string is a series of characters. Anything inside quotes is
considered a string in Python, and you can use single or double
quotes around your strings like this:
"This is a string." 'This is also a string.'
Changing Case in a String with Methods
One of the simplest tasks you can do with strings is change the
case of the words in a string.
Removing Prefixes
When working with strings, another common task is to remove
a prefix. Consider a URL with the common prefix https://. We
want to remove this prefix, so we can focus on just the part of
the URL that users need to enter into an address bar. Here’s
how to do that:
Parentheses ()- Single quotes' ' - Double quotes " "- Square
brackets []- Backslash \ - Underscore _ - Forward slash / –
Dot. - Curly brackets {}
– Semi colon; - colon : - Plus sign + - Equal sign = - Division
sign / - Asterisk * - Dollar sign$ - Hash sign #
“ ” (Curly/Smart Quotes) - an apostrophe ,
Albert Einstein once said, “A person who never made a
mistake never tried anything new.”
Numbers
Numbers are used quite often in programming to keep score
in games, represent data in visualizations, store information
in web applications, and so on. Python treats numbers in
several different ways, depending on how they’re being
used. Let’s first look at how Python manages integers,
because they’re the simplest to work with.
Integers
You can add (+), subtract (-), multiply (*), and divide (/)
integers in Python.