MOD1: H1 - H5 Flashcards
What version of Python am I running?
Python 2.7 (That’s what the BOOK wants for an Answer.)
What is another word for a File “Folder”?
Directory
If I want to edit code in a Text Editor, I should use Microsoft Word or WordPad?
True
False
False
Rich Editors such as Word or Wordpad will destroy your code.
Use Code Editors such as Notepad++ for Windows or TextWrangler on Mac.
Through the command line, create a new folder called “projects” in your home folder. Then, change into that directory and create another folder called “python”.
- Open CMD Line Terminal
- mkdir projects (dir - to confirm new projects directory)
- cd projects
- mkdir python (dir - to confirm new python directory)
In your text editor, create a new file called hello.py in your new python directory (the one you made in Exercise 1). Type print “Hello, world” into it and then save and close it. In your command line, see how big the file is.
- Open CMD Line Terminal
- cd projects
- cd python
- dir
- Find the [hello.py] File and look at the File Size info.
Answer: 24 bytes
A Mastery of Programming and High Level coding is necessary for most Cybersecurity positions?
True
False
False
Programming Awareness means that you can identify programming code, you understanding basic programming constructs and components, such as If/Then Statements and Loops, and can read code and understand in general what the code is trying to do?
True
False
True
Which Text Editor does the Textbook recommend for use with Python?
Notepad Notepad++ WordPad MS Word Google Docs
Notepad++
When working your way through code examples in the Textbook and code presented as part of Canvas-Based Activities, you should copy and write the entire program before proceeding to test and debug your code?
True
False
False
Briefly explain the concept of Unit Testing and why it is important?
Improves the Quality of your code and helps you identify fixable errors and defects.
Define Knowledge Generalization?
The ability to transfer and utilize knowledge across multiple situations.
Takes practice to hone, but highly valued by employers.
How long can a number be?
Number Type is long, and it’s determined by how much memory your machine has. The more numbers it can keep in memory at one time, the longer the number can be.
This shouldn’t be an issue, you would need a number that’s big enough to fill up your available Memory AND your Had Drive, and this would be an enormous number even on the most under-powered machines.
What’s PEP?
Python Enhanced Proposal (PEP)
A document that describes a way in which Python can be made better.
Some don’t affect the language at all (such as the style guide), where as others may add or remove a feature from Python.
What is the difference between = and ==?
== denotes Equals To in a Math scripts to compare values.
= denotes assigning a value to a Variable.
What happens if you add an Integer and a Float?
A Float result is returned by Python.
What’s the result of this statement?
Basic Math - Order of Operations
2 * 3 first = 6
1 + 6 = 7
Answer is 7
What is the difference between an Integer and a Float Variable?
Integer is a Whole Number
Float is going to have a Decimal.
Both are Variable Types that deal with Number Calculations
What is a String?
A String is a Text Variable, the Text wraps within a set of Quotes. The Quotes could be either Single ‘ or Double “, but they Wrap the Text.
A String can be made of numbers, letters, spaces, symbols, or a combination of those - simply, the Output of a String is a Text Variable.
String would not be used in Mathematical Calculations.
Explain the Python String - Function of .lower()?
The .lower() is a Method.
Method’s are used with Strings to change how the Text wrapped within Quotes are formatted.
In the case of .lower(), this Method will convert all the letters in the Text String to Lowercase.
Is there any way to see all the things I can do with a String without looking it up online?
- Make sure you are in Python Shell and at the»_space;> Prompt.
- s = “”
- help(type(s))
Why are the Methods to remove whitespace from the beginning and end of a string called “right strip” and “left strip”? Why not “beginning” and “end”?
In quite of few languages text isn’t printed from left to right.
Arabic and Hebrew are both written from right to left, where as many Eastern scripts are written from top to bottom.
“Right” and “Left” are more universal than “beginning” and “end”.
How big can a String be?
Depends on how much Memory and Hard Drive space your computer has.
Some languages limit the size of a string, but in Python - there is no hard limit.
In theory, one string in your program could fill up your whole Hard Drive!
What characters can be stored in Strings?
Alphabetic Characters, Numbers, Symbols can all be stored in strings.
As well as Whitespace characters such as Spaces and Tabs.
What math operators work in Strings?
Add, Multiply, and Equals using ==.