Last login: Sun Feb 7 10:09:01 on ttys002 The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. (base) MAC:Mon Feb 08:09:52:~> python Python 3.8.5 (default, Sep 4 2020, 02:22:02) [Clang 10.0.0 ] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information. >>> alpha = "abcdefghij" >>> 5 = x File "", line 1 SyntaxError: cannot assign to literal >>> # lvalue: assignable memory >>> alpha.upper() 'ABCDEFGHIJ' >>> alpha 'abcdefghij' >>> alpha.capitalize() 'Abcdefghij' >>> alpha.center(25) ' abcdefghij ' >>> alpha.center(25,*) File "", line 1 alpha.center(25,*) ^ SyntaxError: invalid syntax >>> alpha.center(25,"*") '********abcdefghij*******' >>> magic = "abracadaver" >>> magic.count("a") 4 >>> magic.count("a", 5) 2 >>> magic.count("a", 5,7) 1 >>> magic.endswith("r") True >>> magic.endswith("er") True >>> magic.endswith("ver") True >>> magic.startswith("ba") False >>> magic.startswith("ab") True >>> magic.startswith("abracadaver") True >>> magic.find("c") 4 >>> magic.rfind("a") 7 >>> magic.replace("a", "A") 'AbrAcAdAver' >>> magic.isalnum() True >>> magic += "456" >>> magic 'abracadaver456' >>> magic.isalnum() True >>> magic += ";;;@#%#$!@" >>> magic.isalnum() False >>> s = "2bornot2b" >>> s.isidentifier() False >>> ## rule for vars: starts with alpha or _, rest alphanumeric or _ >>> >>> number_of_eyes - 47 Traceback (most recent call last): File "", line 1, in NameError: name 'number_of_eyes' is not defined >>> number_of_eyes = 47 >>> numberOfEyes = 48 >>> cadet = " \t\t\n\n " >>> cadet.isspace() True >>> print(cadet) >>> cadet ' \t\t\n\n ' >>> poker = " strip now " >>> poker.strip() 'strip now' >>> poker.lstrip() 'strip now ' >>> poker.rstrip() ' strip now' >>> ord("a") 97 >>> ord("b") 98 >>> ord("c") 99 >>> ord("d") 100 >>> bin(ord("d")) '0b1100100' >>> ord("&") 38 >>> bin(ord("&")) '0b100110' >>> chr(97) 'a' >>> chr(99) 'c' >>> chr(98) 'b' >>> chr(945) 'α' >>>