Last login: Wed Feb 10 10:23:45 on ttys000 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:Wed Feb 10:11:31:~> cd book (base) MAC:Wed Feb 10:11:31:book> ls Listings Package Documentation.pdf linear S1 main.tex S2 math Scripts newInterface.tex SisterMaryA oldForLoop.tex SisterMaryB package.tex archive packageincludes.tex assortedJava png backup ppp bigSum.py programmingProjects bm.py pydoc book0.bib python book2.bib resume.tex book_example.tex sample.tex code_snippet.zip scipy crypto search.py extras.bib second.txt figureTemplate.tex secondHalfj12.tex findSize.py sq.py foot.tex square.py google squareEx.py head.tex test img.tex test.c include.txt test.py includegraphics.txt testPandoc java texput.log java.tex title_page_1.tex jlatexAll.sh turtle jpdfAll.sh unix lab vebdew linAlg webdev (base) MAC:Wed Feb 10:11:31:book> cd java (base) MAC:Wed Feb 10:11:31:java> ls AStack.class colorCalculator.tex j5 AStack.java colorCalculatorCore.tex j5FX.aux BallWorld.java cube j5FX.log BenDeckerIsNuts.java default j5FX.out ByChars.class editor j5FX.pdf ByChars.java end3OldCore.tex j5FX.tex ByWords.class fang.py j5FX.toc ByWords.java file.txt j5FXcore.tex CanvasDemo.class foo.py j5New Cat.class foo.txt j5PureCore.tex Cat.java fool.py j6 CollectorsExample.java goodPart.tex j6FX Curve.class gradle j6FX.aux Curve.java graphics.tex j6FX.log Example.class harvest.tex j6FX.out Example.java headfoot.tex j6FX.pdf Foo.class hippo.aux j6FX.tex Foo.java hippo.log j6FX.toc Functions.tex hippo.out j6FX.zip FunctionsCore.tex hippo.pdf j6FXNew.pdf Hello.java hippo.tex j6FXNew.tex HiPPoPotamus.java hippo.toc j6FXNewcore.tex IStack.class hippoCore.tex j6FXcore.tex IStack.java hippoCoreNEW.tex j6coreNew.tex MouseDemo.class images j7.tex Num.java includegraphics j7FX Person.class iter j7FX.pdf Person.java j0.aux j7FX.tex Point.class j0.log j7FXcore.tex Point.java j0.out j7Fx.aux Profile.class j0.pdf j7Fx.log Profile.java j0.tex j7Fx.out RPoint.class j0core.tex j7Fx.toc RPoint.java j1.aux j7core.tex Shuffle.java j1.log j8 Shuffling.java j1.out j8.aux Skimmer.class j1.pdf j8.log Skimmer.java j1.tex j8.out Sordid.java j1.toc j8.pdf Sorting j11.tex j8.tex Sorting.aux j11core.tex j8.toc Sorting.log j12 j8FX Sorting.out j12.aux j8FX.aux Sorting.pdf j12.log j8FX.log Sorting.tex j12.out j8FX.out Sorting.toc j12.pdf j8FX.pdf StreamSimple.java j12.tex j8FX.tex Streams.aux j12.toc j8FX.toc Streams.log j12Acore.tex j8FXcore.tex Streams.out j12core.tex j8core.log Streams.pdf j13.aux j8core.tex Streams.tex j13.log j9FX Streams.toc j13.out j9FX.aux StreamsCore.tex j13.pdf j9FX.log StrictJavaScope.java j13.tex j9FX.pdf StringList.java j13.toc j9FX.tex Truncator.class j13core.tex j9FX.toc Truncator.java j14 j9FXcore.tex UniDraw.class j14.aux java.bib UniDraw.java j14.log javaCode Untitled.ipynb j14.out javaStreams.pdf UpCast.java j14.pdf jay.txt _minted-Sorting j14.tex jbook.tex _minted-Streams j14.toc jsoup _minted-Varargs j14core.tex junk.py _minted-hippo j15.pdf knappe.py _minted-j0 j15.tex lstackshell _minted-j1 j15core.tex minted.txt _minted-j12 j16.tex nitpad _minted-j13 j16core.tex old _minted-j14 j1core.log org _minted-j15 j1core.pdf prefaceJava.pdf _minted-j1NEW j1core.tex prefaceJava.tex _minted-j2 j2.aux prefaceJavaCore.tex _minted-j3 j2.log pythonImages _minted-j4 j2.out regex.aux _minted-j5 j2.pdf regex.log _minted-j5FX j2.tex regex.out _minted-j6FX j2.toc regex.pdf _minted-j6FXNew j2core.tex regex.tex _minted-j7FX j3.aux regex.toc _minted-j8 j3.log regexcore.tex _minted-j8FX j3.out s9core.tex _minted-j9 j3.pdf sampler.txt _minted-j9FX j3.tex stackHeap.tex _minted-regex j3.toc stackHeapCore.tex antcolony j3core.tex streams backup j4.aux texput.log bindings j4.log tmp bozo.py j4.out tmp.txt buf j4.pdf valueOf calc j4.tex zip.py clock j4.toc color j4core.tex (base) MAC:Wed Feb 10:11:31:java> grep quickSort * Sordid.java: public static > void quickSort(List list) Sordid.java: quickSort(list, 0, list.size()); Sordid.java: private static > void quickSort(List list, int start, int endBefore) Sordid.java: quickSort(list, start, divide - 1); Sordid.java: quickSort(list, divide + 1, endBefore); Sordid.java: quickSort(al); grep: _minted-Sorting: Is a directory grep: _minted-Streams: Is a directory grep: _minted-Varargs: Is a directory grep: _minted-hippo: Is a directory grep: _minted-j0: Is a directory grep: _minted-j1: Is a directory grep: _minted-j12: Is a directory grep: _minted-j13: Is a directory grep: _minted-j14: Is a directory grep: _minted-j15: Is a directory grep: _minted-j1NEW: Is a directory grep: _minted-j2: Is a directory grep: _minted-j3: Is a directory grep: _minted-j4: Is a directory grep: _minted-j5: Is a directory grep: _minted-j5FX: Is a directory grep: _minted-j6FX: Is a directory grep: _minted-j6FXNew: Is a directory grep: _minted-j7FX: Is a directory grep: _minted-j8: Is a directory grep: _minted-j8FX: Is a directory grep: _minted-j9: Is a directory grep: _minted-j9FX: Is a directory grep: _minted-regex: Is a directory grep: antcolony: Is a directory grep: backup: Is a directory grep: bindings: Is a directory grep: calc: Is a directory grep: clock: Is a directory grep: color: Is a directory grep: cube: Is a directory grep: editor: Is a directory grep: gradle: Is a directory grep: images: Is a directory grep: j12: Is a directory j13core.tex: quickSort(List list, int start, int endBefore) j13core.tex: quickSort(list, start, divide - 1); j13core.tex: quickSort(list, divide + 1, endBefore); j13core.tex:public static > void quickSort(List list) j13core.tex: quickSort(list, 0, list.size()); grep: j14: Is a directory grep: j5: Is a directory grep: j5New: Is a directory grep: j6: Is a directory grep: j6FX: Is a directory grep: j7FX: Is a directory grep: j8: Is a directory grep: j8FX: Is a directory grep: j9FX: Is a directory grep: javaCode: Is a directory grep: jsoup: Is a directory grep: nitpad: Is a directory grep: old: Is a directory grep: org: Is a directory grep: pythonImages: Is a directory grep: streams: Is a directory (base) MAC:Wed Feb 10:11:31:java> grep quickSort *.tex j13core.tex: quickSort(List list, int start, int endBefore) j13core.tex: quickSort(list, start, divide - 1); j13core.tex: quickSort(list, divide + 1, endBefore); j13core.tex:public static > void quickSort(List list) j13core.tex: quickSort(list, 0, list.size()); (base) MAC:Wed Feb 10:11:32:java> vi j13core.tex (base) MAC:Wed Feb 10:18:37:java> cd (base) MAC:Wed Feb 10:18:37:~> B (base) MAC:Wed Feb 10:18:37:4240> cd students (base) MAC:Wed Feb 10:18:37:students> mv ~/Downloads/image_123927839.JPG appel21d/convert.jpg (base) MAC:Wed Feb 10:18:38:students> pwd /Users/morrison/20202021/S2/4240/students (base) MAC:Thu Feb 11:10:24:students> cd .. (base) MAC:Thu Feb 11:10:24:4240> ls 0204B.txt B.txt all.txt ch3 present.txt temp.text 0204F.txt F.txt ch2 email.txt students (base) MAC:Thu Feb 11:10:24:4240> cd ch2 (base) MAC:Thu Feb 11:10:24:ch2> ls 0208B.txt 0210F.txt formatF.py htmlify.py lab1.html 0208F.txt foo.py hello.py htmlify3.py sess.txt 0209B.txt format.py helloF.py lab1.css sess.txt.out (base) MAC:Thu Feb 11:10:24: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. >>> x = [1,2,3] >>> y = x >>> x [1, 2, 3] >>> y [1, 2, 3] >>> y[0] = 6 >>> x [6, 2, 3] >>> y [6, 2, 3] >>> x[0] 6 >>> x[2:3] [3] >>> x[2:3] [ ... ... KeyboardInterrupt >>> x[2:3] = ["a", "b", "c"] >>> x [6, 2, 'a', 'b', 'c'] >>> x[1:1] = [40,50,60] >>> x [6, 40, 50, 60, 2, 'a', 'b', 'c'] >>> x[1:1] = "cat" >>> x [6, 'c', 'a', 't', 40, 50, 60, 2, 'a', 'b', 'c'] >>> "splicing" 'splicing' >>> #rosemary woods >>> x[::2] [6, 'a', 40, 60, 'a', 'c'] >>> x[1::2] ['c', 't', 50, 2, 'b'] >>> x[1::3] ['c', 40, 2, 'c'] >>> x = 1 >>> y = 2 >>> x,y = y,x >>> x 2 >>> y 1 >>> q = [4,5,6] >>> x,y,z = q >>> x 4 >>> y 5 >>> z 6 >>> c, d = q Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack (expected 2) >>> q [4, 5, 6] >>> x,y,z = q >>> #tuple >>> #tuples are immutible lists >>> t = (2,3,4) >>> t[0] = 5 Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not support item assignment >>> id(t) 140524240244096 >>> t += (5,6) >>> t (2, 3, 4, 5, 6) >>> id(t) 140524239982000 >>> t = [2,3,4] >>> id(t) 140524240441728 >>> t += [5,6] >>> id(t) 140524240441728 >>> t = (2,3,4) >>> id(t) 140524240244096 >>> t[1:2] (3,) >>> t[1:2] = "cow" Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not support item assignment >>> t (2, 3, 4) >>> list(t) [2, 3, 4] >>> tuple([5,6,7]) (5, 6, 7) >>> tuple("cowabunga") ('c', 'o', 'w', 'a', 'b', 'u', 'n', 'g', 'a') >>> #tuple is a heterogeneous immmutable sequence type >>> #strings, tuples, lists >>> #Sets Education >>> s = set() >>> s set() >>> s.add("cows") >>> s {'cows'} >>> print(s.add("horses")) None >>> s {'horses', 'cows'} >>> s.add("cows") >>> s {'horses', 'cows'} >>> #set is a hashed type >>> hash("cows") 458011835615197326 >>> hash([1,2,3]) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list' >>> hash((2,3,4)) -3165226637586315787 >>> hash(2) 2 >>> hash(3) 3 >>> hash("3141142") 1104951890463070484 >>> hash(2000) 2000 >>> hash(4000) 4000 >>> hash(16000) 16000 >>> hash(32000) 32000 >>> hash(64000) 64000 >>> hash(1000000) 1000000 >>> hash(10000000) 10000000 >>> hash(100000000) 100000000 >>> hash(1000000000) 1000000000 >>> hash(10000000000) 10000000000 >>> hash(100000000000) 100000000000 >>> hash(1000000000000) 1000000000000 >>> hash(1000000000000) 1000000000000 >>> hash(10000000000000) 10000000000000 >>> set >>> s {'horses', 'cows'} >>> "horses" in s True >>> set = set(["cow", "cow", "horse", "elephant", "ibex", "giraffe"]) >>> set {'giraffe', 'ibex', 'elephant', 'horse', 'cow'} >>> del(set) >>> farm = set(["cow", "cow", "horse", "elephant", "ibex", "giraffe"]) >>> farm {'giraffe', 'ibex', 'elephant', 'horse', 'cow'} >>> zoo = set(["monkey", "ibex", "giraffe", "lion", "dragon of Komodo"]) >>> zoo {'giraffe', 'ibex', 'monkey', 'lion', 'dragon of Komodo'} >>> farm {'giraffe', 'ibex', 'elephant', 'horse', 'cow'} >>> zoo.intersection(farm) {'giraffe', 'ibex'} >>> zoo.union(farm) {'giraffe', 'ibex', 'elephant', 'monkey', 'lion', 'dragon of Komodo', 'horse', 'cow'} >>> farm + zoo Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for +: 'set' and 'set' >>> farm.symmetric_difference(zoo) {'monkey', 'elephant', 'lion', 'dragon of Komodo', 'horse', 'cow'} >>> both zoo.intersection(farm) File "", line 1 both zoo.intersection(farm) ^ SyntaxError: invalid syntax >>> both = zoo.intersection(farm) >>> both <= farm True >>> both {'giraffe', 'ibex'} >>> farm {'giraffe', 'ibex', 'elephant', 'horse', 'cow'} >>> farm <= both False >>> nonfarm = zoo.difference(farm) >>> nonfarm {'monkey', 'dragon of Komodo', 'lion'} >>> x [1,1,2,3,4,4,5,7] Traceback (most recent call last): File "", line 1, in TypeError: 'int' object is not subscriptable >>> x =[1,1,2,3,4,4,5,7] >>> list(set(x)) [1, 2, 3, 4, 5, 7] >>> farm {'giraffe', 'ibex', 'elephant', 'horse', 'cow'} >>> farm.sort() Traceback (most recent call last): File "", line 1, in AttributeError: 'set' object has no attribute 'sort' >>> farm[1] Traceback (most recent call last): File "", line 1, in TypeError: 'set' object is not subscriptable >>> d = {} >>> type(d) >>> d["morrison"] = 2746 >>> d {'morrison': 2746} >>> d["flyboyh"] = 2742 >>> d {'morrison': 2746, 'flyboyh': 2742} >>> list(d.keys()) ['morrison', 'flyboyh'] >>> list(d.values()) [2746, 2742] >>> (base) MAC:Thu Feb 11:11:11:ch2> cd ., -bash: cd: .,: No such file or directory (base) MAC:Thu Feb 11:11:11:ch2> cd .. (base) MAC:Thu Feb 11:11:11:4240> ls 0204B.txt B.txt all.txt ch3 present.txt temp.text 0204F.txt F.txt ch2 email.txt students (base) MAC:Thu Feb 11:11:11:4240> cd students (base) MAC:Thu Feb 11:11:12:students> ls alexander22d garg21a lasoski22t sloan21a appel21d garrett21w lei21c sud21n bauernfeind21d gududuru21a mcnutt22z surkin21s bunch21m hallihan21a mitchellm targett21j burgess21k haugan22z moore21a thomas21h clodfelter21o heider21h nerurkar21o zhang21evan crowley21j hensley21i parker21c zhang22benjamin fewell21m jujita22t railey22j zhu21s fujitat kersey21n ravichandran22v gamboa21p kim21t rayapalli21v (base) MAC:Thu Feb 11:11:12:students> ls clodfelter21o/ convert.jpg (base) MAC:Thu Feb 11:11:12:students> ls crowley21j/ academicHonesty.pdf convert.png (base) MAC:Thu Feb 11:11:12:students> 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. >>> x = 20 >>> y = 13 >>> bin(x) '0b10100' >>> bin(y_ ... ) Traceback (most recent call last): File "", line 1, in NameError: name 'y_' is not defined >>> bin(x) '0b10100' >>> bin(y) '0b1101' >>> x^y 25 >>> bin(x^y_ ... ) Traceback (most recent call last): File "", line 1, in NameError: name 'y_' is not defined >>> bin(x^y) '0b11001' >>> x|y + x&y 21 >>> x 20 >>> y 13 >>> x^y + x&y 21 >>> x&y + x|y 13 >>> int(True) 1 >>> int(False) 0 >>> True + False 1 >>> True + True 2 >>>