0% found this document useful (0 votes)
17 views

Basic Programming in Python - Notes

Uploaded by

8fxkpvgqkn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Basic Programming in Python - Notes

Uploaded by

8fxkpvgqkn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Lecture 1: Introduction – Basic Programming in Python

Class Goals

1. Set up ability to understand more advanced cybersecurity topics


 There is a limit to the discussions we can have about cyber security without least
some knowledge of programming.
2. Set you up for greater success in industry/academia
3. Be able to have semi-technical discussions
4. Teach you something is actually useful to you now

Potential Uses

 Automation
 Data collection and processing
 Money
 Animation
 Gaming
 Machine Learning  Python is the language for this

Programming as a skill

1. Breaking down the problem (30% of the skill)

 Taking the larger problem, and figuring out the individual steps
 You should already have an idea of how to do this
 Example: writing an essay

 Start

2. Translating steps/tasks to instructions (60% of the skill)

 Taking the steps you found when breaking down the problem, and

3. Writing the syntax/keywords (10% of the skill)

 Language specific
 Fairly straightforward if you did the previous two steps

 It’s really important to learn to break down problems and translate them for
computers.

Biggest pitfalls
1. Treating code like an academic axercise

 Learning how to swim by reading a book

2. Only focusing on writing code,and not on the problem solving

 Actually writing syntax/keywords is very easy


 Breaking down the problem to figure out steps is much harder

3. Coding too late

 The longer you wait, the harder it is to catch up

4. Not coding in class

 You’ll gain little by writing notes

5. Coding in class by copying everything exactly

 <…>

Language

<…>

High-level

 Assembly language
 Hardware
 Machine Language
 High Level Language

Interpreted

 Compiled Language  run the code through compiler and make it executable which
takes more time but runs faster

 Interpreted Language  This is Python, start from the code and run it
straightforward, there is no compiler. It runs everything up until an error.

General-purpose

 Domain-specific Languages

 HTML
 SQL
 General-purpose Languages  This is Python

Object-oriented

 Has the concept of “Objects”


 We will cover this topic in great detail over two lectures

Integrated Development Environment (IDE)

 Pycharm is an IDE

Keywords

- Specific words that have set meaning

 Most programming languages have them

Syntax

 Defines the structure of the language


 Where most general-purpose languages will differ
 Python has significant spacing

 Tabs mean something in Python, in most languages they don’t.

 Python also uses colons

 <…>

What did we learn from the activity?

 Specificity is important
 Little mistakes can make a big difference
 Abstraction is useful

 Allows you to focus on the bigger picture, not on the little things.

 Computers follow instructions

 If a computer isn’t doing what you want it to do – it’s because you told it to do
the wrong thing!

 Breaking down the problem is much harder than writing the actual instructions

Lecture 2:
Float

- Decimal values

- 5.0 for example is a float

Integer

 d

String

- “5.0” for example is a string

 Holds text

Boolean

 True/False Value
 Examples:

 True
 False

Lecture 3: Control Flow + Input and Parsing


Comments in Python

 Comments are code that doesn’t run

 # Your comment here

- Just to take notes

Input()

 Taking input from the user is easy


 VariableName = input()
 What will it return?  it will return what the user types in the console

 This is an argument. The function takes this as input

 Returns a string with whatever the user enters

 Either save it in a variable

 Or use it as an argument for another function

Conditions

Comparisons
 ==
 >
 <
 
 >==

Booleans

Lecture 4: Loops
d

You might also like