Last login: Thu Feb 4 12:34:46 on ttys003 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:Thu Feb 04:12:44:~> 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. >>> 4 + 9 13 >>> 4*9 36 >>> 4 - 9 -5 >>> 4/9 0.4444444444444444 >>> 4//9 0 >>> 365//7 52 >>> 2**10 1024 >>> 365 % 7 1 >>> 4**(.5) 2.0 >>> 4**(1/3) 1.5874010519681994 >>> 2**1000 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376 >>> #integers are of pretty much unlimited size, subject to memory >>> type(5) >>> type(1/2) >>> 1.0001**1000 1.1051653926032206 >>> 1.0001**10000 2.7181459268249255 >>> 7.8 + 2.3 10.1 >>> 7.8/2.3 3.3913043478260874 >>> 7.8*2.3 17.939999999999998 >>> # float: IEEE754 >>> # 64 bit floating point numbers >>> 2**64 18446744073709551616 >>> .1 + .1 + .1 0.30000000000000004 >>> 1/4 0.25 >>> .25 + .25 == .5 True >>> 3/10 0.3 >>> 1/3 0.3333333333333333 >>> .1 + .1 + .1 == .3 False >>> 5.3 % 2.4 0.5 >>> 5^7 2 >>> 5**7 78125 >>> 4 + 1.5 5.5 >>> 23453143413253254132314*1.0 2.345314341325325e+22 >>> 2**1000*1.0 1.0715086071862673e+301 >>> 2**10000*1.0 Traceback (most recent call last): File "", line 1, in OverflowError: int too large to convert to float >>> int(4.5) 4 >>> int(-4.5) -4 >>> float(4) 4.0 >>> ## cast: temporary request to regard a datum of one type >>> #as being of another >>> >>> z = complex(3,4) >>> z (3+4j) >>> z*z (-7+24j) >>> complex(3,4) + complex(4,5) (7+9j) >>> 4 > 5 False >>> 4*4 < 5*5 True >>> 1 + 2 < 5 + 6 True >>> #arithmetic operations have precedence over relational operators >>> 1 + 2 == 5 + 6 False >>> 1 + 2 <= 5 + 6 True >>> 1 + 2 >= 5 + 6 False >>> 1 + 2 != 5 + 6 True >>> 2**3**2 512 >>> +, - * / associate from left to right. File "", line 1 +, - * / associate from left to right. ^ SyntaxError: invalid syntax >>> # +, - * / associate from left to right. >>> #exponentiaton associates from right to left. >>> >>> #infix binary operator >>> #prefix unary operator >>> -5 -5 >>> type(False) >>> abs(-4) 4 >>> abs(-4.5) 4.5 >>> z = complex(3,4) >>> abs(z) 5.0 >>> (base) MAC:Thu Feb 04:13:29:~> ls 2020-12-04_132133.mp4 2020-12-04_132141.jpg 20202021 211 4240Chapter5.cmproj ACSL Anaconda3-2019.10-MacOSX-x86_64.sh Applications CLASSES Classes20161017 Classes20172018 Classes20182019 Classes20192020 D3Book DNS.txt Desktop Documents Downloads EBOOKS FrameExample.class FrameExample.java Gotwals.class Gotwals.java IdeaProjects IfConfig.txt Ken2019.jpg Library Main.class Main.java Movies Music Musicott NetBeansProjects OReilly Pictures Postman Projects Public PycharmProjects Qt Sites Top.txt Untitled.ipynb Untitled1.ipynb Untitled2.ipynb User.class User.java VirtualBox VMs XQ __pycache__ a abby.jpeg acsl.py amigo anaconda3 api_key.txt apisupport att.txt attUpgrade.txt b bash beacon.txt bin birken.c bob.py book buf button.css button.html button.js byte.txt calamari camtasiaRecordings cartopy ce change.sh chapter0.cmproj chapter0Part1.mp4 client.py codeWars com.paloaltonetworks.GlobalProtect.settings.plist commando.py compilePackagesInJava computeSize.awk costco.txt cpr csv data dataviz-with-python-and-js debug_drv.log dg dock.c donut.jpeg ducats dukeforest dynamicProgramming eclipse eclipse-workspace eclipse-workspace-web emmaTova.jpeg euler explain.txt fib fib.c final.html first.py firstName.py fixmain flask_proto flush.css flush.html flush.js flyboy.html fns.py foo foo.c foo.js foo.py foo.txt fxml gator geojson-counties-fips.json gotwals.py grad19 grandpa.txt groovy harness hello.py hello.txt hubbub.c hubbub.py hughJass.txt ide igcc-0.2 iguana index.php inputDemo.css inputDemo.html inputDemo.js insult.js ipevoVideos java javafx javafx-sdk-15 javafx.bat javafxc.bat jbr_err_pid11266.log junk.js junk.txt jupiter jv keethan.py lab1.css lab1.html lanois lib.py licenses listGames loopy mahlin.docx main makeFX.py mateFools.py matt.py mbox mess.gif miniterm move nasty.c nb nbbuild nbi newEdition node_modules nom note.txt nude.css nude.html nude.js numberName openjfx-15_osx-x64_bin-sdk.zip package-lock.json pasta patient.jpg phone.txt php picky.py pix platform prettify profiler programming project pygame pyqt pythontools qt5 rh.py rhino.gif rhino.gif.1 roster.txtc rudin.jpg rudin.webp s6coreNew.tex sample.mp4 sampler.txt sandbox scipy scrabble.txt security seuss.txt shannon.html shapes.zip skeleton.sh snark.jpeg start.py startPage.html static swift teaching tigger.jpg tons.xlsx turtle.pdf typescript urllib valgrind-macos vsedit webcommon websvccommon youTube (base) MAC:Thu Feb 04:13:29:~> cd 20202021/S2/ (base) MAC:Thu Feb 04:13:29:S2> ls 4240 4280 mail (base) MAC:Thu Feb 04:13:29:S2> cd 4240 (base) MAC:Thu Feb 04:13:29:4240> ls 0204B.txt F.txt ch2 present.txt temp.text B.txt all.txt email.txt students (base) MAC:Thu Feb 04:13:29:4240> cd ch2 (base) MAC:Thu Feb 04:13:29:ch2> ls format.py hello.py helloF.py (base) MAC:Thu Feb 04:13:29:ch2> python hellF.py python: can't open file 'hellF.py': [Errno 2] No such file or directory (base) MAC:Thu Feb 04:13:29:ch2> python helloF.py Hello, World (base) MAC:Thu Feb 04:13:29:ch2> 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 = "abcdefghijklmnopqrstuvwxyz" >>> print(alpha) abcdefghijklmnopqrstuvwxyz >>> beta = 'single-quotes' >>> 'unbalanced" File "", line 1 'unbalanced" ^ SyntaxError: EOL while scanning string literal >>> alpha[0] 'a' >>> alpha[1] 'b' >>> alpha[25] 'z' >>> alpha[26] Traceback (most recent call last): File "", line 1, in IndexError: string index out of range >>> alpha[:3] 'abc' >>> alpha[3:] 'defghijklmnopqrstuvwxyz' >>> alpha[:3] + alpha[3:] 'abcdefghijklmnopqrstuvwxyz' >>> alpha[4:8] 'efgh' >>> alpha[0] = "A" Traceback (most recent call last): File "", line 1, in TypeError: 'str' object does not support item assignment >>> soup = "turtle" >>> car = "turtle" >>> soup == car True >>> car is soup True >>> goop = soup[:] >>> goop 'turtle' >>> soup 'turtle' >>> car 'turtle' >>> goop is soup True >>> a Traceback (most recent call last): File "", line 1, in NameError: name 'a' is not defined >>> alpha 'abcdefghijklmnopqrstuvwxyz' >>> alpha.upper() 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' >>> alpha 'abcdefghijklmnopqrstuvwxyz' >>> goop.upper() 'TURTLE' >>> "cowABunGa".swapcase() 'COWabUNgA' >>> alpha.find("q") 16 >>> alpha 'abcdefghijklmnopqrstuvwxyz' >>> alpha[16] 'q' >>> city = "albaquerque" >>> city.find("q") 4 >>> city.rfind("q") 8 >>> alpha.find("ghi") 6 >>> alpha[6] 'g' >>> alpha[6:6 + len("ghi")] 'ghi' >>> alpha.find("6") -1 >>>