The very first text operations and basic information about Python that helps you start programming right away:
# Comments
Delimiters ” or “” and escaping characters ’ and ”
print(‘Hello world’) – newline
end=’…’ – next print will be glued
escape sequences:
a – system speaker
n – newline (empty line)
t – tab type indent
+ string concatenation without delimiter
* repeat lines without delimiter
continuation of a line of code on the next line
input(‘Press Enter to exit’)
Basic mathematical operators (+,-,*,/,//,%).
Compound assignment statements
String methods (applied to a string with text): I am cat
.upper() I Am CAT
.lower() i am cat
.title() I Am Cat
.replace(old,new,max number of replacements) replaces the old text with the new one
.swapcase() reverse case i Am Cat
.capitalize() the first letter is capital, the rest are lowercase I am cat
.strip() string without intervals Iamcat
Читать →