02_Cisco_Chapter_1_Lecture (Module 1 Lecture 2)
02_Cisco_Chapter_1_Lecture (Module 1 Lecture 2)
(Module 1 Lecture 2)
And Murach Chapter 1
https://youtu.be/CkOOazEJcUc?t=91
https://youtu.be/CkOOazEJcUc?t=92 1:31
02_Cisco_Chapter_1_Lecture
Announcement-type things…
• If there is a line of code that crashed your program, please comment
that out so the first time I run the code it works out of the box. That
way I know that you know that line of code was no good. (But leave it
there, it counts as an experiment!)
• Feel free to overwrite any placeholder files I have left in your turn it in
folder. Some will need to rename their 001_C file.
• First two lines of each .py file:
#!/usr/bin/env python3
#Dave Kerr
• #Experiments Below ----------
A Typo That Cost NASA Over $600 Million – Youtube accessed March 2019
Review
1. What two resources do you need as “textbooks” for this class?
2. Where can you see all the files you will need to hand in for this
course?
3. What are the two places you need to go to hand in homework?
Three Questions For today:
1. What is not backwards compatible with Python?
2. What are two base-languages that Python flavors are built on?
3. What do these mean - and which do you think is easier to
understand? 0x and 0o
Programming is detail-oriented - let’s not
waste $150,000,000!
• Don’t assume you did it correctly the first time!
• and don’t use punch cards!
• https://youtu.be/CkOOazEJcUc?t=91
• https://youtu.be/CkOOazEJcUc?t=92 1:31
Decimal, Binary, Octal, and
Hexadecimal Counting Systems
• Decimal (Deci means 10) – your normal numbering 0 – 9 (note that is ten #’s)
• 0-9 fits in one column. When filled it goes back to zero and the next column gets a bump up
right? 009 + 1 = 010 and 099 + 1 = 100
• Binary (Bi means two) uses 0 or 1 in a column
• 0 or 1 in one column. When the column is filled, it bumps the next one up. 00000001 +1 =
00000010 and 00001111 + 1 = 00010000
• Octal (Oct means 8) uses 0 – 7, usually denoted “0o” like 0o52
• 0-7 fits in one column. 0o007 + 0o001 = 0o010
• Hexidecimal (Hex means six, Deci means 10, together =16) 0 – 9, A,B,C,D,E and F
• 0 – F fits in one column. Denoted “0x” like 0x52 or 0x5F4D1
• 0x000F + 1 = 0x0010, 0x00FF + 1 = 0x0100
• 0x0009 + 1 = 0x000A, 0x000B + 1 = 0x000C
Each row has the same value, 8-bit byte version
Decimal Binary Octal Hexadecimal
Interpret:
Python code Python.exe
Binary kernel
IDE’s (Integrated Development Environment)
IDLE = Integrated Dev and Learning Envmt
• Integrates a console, an editor, and a debugger, and maybe more!
• Console = window where you see output from your program and helps you
interact with your OS and execute commands.
• Editor = Where you develop your program – usually points out errors
• Debugger = helps you stop and start your program and see what the
variables are changing to without you having to restart every time you
want to see something.
• Compiler: When you are ready to run the program on your computer you
need it in machine code. This does that job automatically.
• Interpreter: Also compiles, but sends the code straight to the computer –
you do not need the entire program to run a part of it.
Scripting
• A text file containing instructions
• Usually code that coordinates other code (automation)
• This also makes Python excellent for creating and executing tests for
applications.
Compatibility of Python Flavors
• Java vs. C compatibility
• Almost all versions of Python are written to compile/interpet through C.
• A few are highly modified to use languages such as Java.
• *Either way, the source code is written in Python, and the performance is based
upon how good the interpreter is. Python source code (what you write) for Java will
be identical to that for C.