SlideShare a Scribd company logo
Introduction
Unit Guide
■ Unit Description
■ Learning Outcomes
■ Assessments
■ Expectations
What is Computer Security?
■ Most developers and operators are concerned with correctness: achieving desired
behaviour
• A working software
• A working banking web site, word processor, blog,
• …
■ Security is concerned with preventing undesired behaviour
• Considers an enemy/opponent/hacker/adversary who is actively and maliciously trying
to circumvent any protective measures you put in place
Significant security breaches
■ Marriott International, November 2018
• Stole 500 million customers data, including contact info, passport number, travel
information, and credit card numbers of more than 100 million customers.
■ Equifax, July 2017
• Personal information (including Social Security Numbers, birth dates, addresses, and in
some cases drivers' license numbers) of 143 million consumers; 209,000 consumers
also had their credit card data exposed.
■ Yahoo, September 2016
• 3 billion user accounts are compromised, including names, dates of birth, email
addresses, passwords, security questions and answers.
Contributing Factors
■ Lack of awareness of threats and risks of information systems
• Security measures are often not considered until an Enterprise has been penetrated by
malicious users
• The situation is getting better, but …
■ (Historical) Reluctance to invest in security mechanisms
• The situation is improving
• Example: Windows 95 -> Windows 2000 -> Windows XP -> Windows Vista -> Windows
7 -> Windows 8 -> Windows 10 -> Windows 11
• But there exists legacy software
• Supply chain security
■ Wide-open network policies
• Many Internet sites allow wide-open Internet access
Contributing Factors continued
■ Lack of security in TCP/IP protocol suite
• Most TCP/IP protocols not built with security in mind
• Work is actively progressing within the Internet Engineering Task Force (IETF)
■ Complexity of security management and administration
• Security is not just encryption and authentication
■ Software vulnerabilities
• Example: buffer overflow vulnerabilities
• We need techniques and tools to better software security
■ Hacker skills keep improving
• Cyber warfare
Compusec + Comsec = Infosec
Security Mechanisms
■ Prevention is more fundamental
• Detection seeks to prevent by threat of punitive action
• Detection requires that the audit trail be protected from alteration
■ Sometime detection is the only option, e.g.,
• Accountability in proper use of authorized privileges
• Modification of messages in a network
■ Security functions are typically made available to users as a set of security services
■ Cryptography underlies (almost) all security mechanisms
Application Security
■ Application security usually refers to security after the software is built
• Adding more code does not make a faulty software correct
• Sandboxing
• Network-centric approach
• Focus on input checking
Why Software Security?
■ Software Security aims to
address weaknesses
directly
HeartBleed
■ SSL/TLS is a core protocol for encrypted communications used by the web
■ Heartbleed is a bug in the commonly used OpenSSL implementation of SSL/TLS, v1.0.1 -
1.0.1f – Discovered in March 2014, it has been in released code since March 2012
■ A carefully crafted packet causes OpenSSL to read and return portions of a vulnerable
server’s memory – Leaking passwords, keys, and other private information
Why existing security software didn’t work?!
■ Black box security is incomplete against Heartbleed exploits
• Issue is not at the level of system calls or deposited files: nothing the OS or antivirus
can do
• Basic attack packets could be blocked by IDS, but
• “Packet chunking” may bypass basic filters
• Exfiltrated data on the encrypted channel; invisible to forensics
■ Software security methods attack the source of the problem: the buggy code
Security Assurance
■ How well your security mechanisms guarantee your security policy
■ Everyone wants high assurance
■ High assurance implies high cost
• May not be possible
■ Trade-off is needed
Security by Obscurity
■ Security by obscurity
• If we hide the inner workings of a system it will be secure
• E.g., steganography
■ Less and less applicable in the emerging world of vendor-independent open standards
■ Less and less applicable in a world of widespread computer knowledge and expertise
Programming and Secure software development presentation consists of various slides which shed light on concepts like using python for writing scripts to secure a network.
Install Python
https://www.python.org/
Download and Install the latest Python:
Why Python?
•Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
•Python has a simple syntax similar to the English language. (Friendly and Easy to Use)
•Python has syntax that allows developers to write programs with fewer lines than some
other programming languages.
•Python runs on an interpreter system, meaning that code can be executed as soon as it is
written. This means that prototyping can be very quick.
•Python can be treated in a procedural way, an object-oriented way or a functional way.
Install PIP
For Instructions see here:
https://www.geeksforgeeks.org/download-and-
install-pip-latest-version/
https://pypi.org/project/pip/
Why pip? pip is the package installer for Python.
You can use pip to install packages from
the Python Package Index and other indexes.
Install Jupyter NoteBook
For Instructions see here:
https://jupyter.org/install
Why Jupyter Notebook? A Jupyter Notebook provides you with an
easy-to-use, interactive environment a different approach for an IDE
with short, explanation and presentation of code, which helps us
focus on the meaning.
In a Windows/Linux/Mac terminal
Programming and Secure software development presentation consists of various slides which shed light on concepts like using python for writing scripts to secure a network.
Run Jupyter NoteBook
Windows/Linux/Mac Command Line:
jupyter notebook
Tip: Use Dark Mode – reduces the light by
~80%, which causes strain on your eyes.
Create a Jupyter NoteBook
Note:
Console – Python Console (accept
python commands)
Notebook – creates a new Notebook
Terminal – OS Terminal (we’ll use this)
Text file – a simple ACSII file
Markdown File – a Jupyter markdown
file, no code, only comments.
Python File – python source code file
Selecting a Kernel
Notebooks are compatible with several
programming languages.
We’ll always use Python in this class.
It can support:
Julia, Python, R.
Your First Notebook: Hello World
Type:
print(“Hello World”’)
Be careful:
Automatic talking marks,
punctuation, etc.
1. Type
2. Click Run
Success!!
Programming and Secure software development presentation consists of various slides which shed light on concepts like using python for writing scripts to secure a network.
Markdown
1. Type the following (Just text)
2. Select Markdown.
3. Run -> Render All Markdown Cells
Add New Blocks
Copy/Duplicate Block
Move the Block UP
Move the Block DOWN
Delete Block
Click Here: Add New Block Below
Add New Block Abov
Try Some Basic Code Maths
Type:
Output:
Programming and Secure software development presentation consists of various slides which shed light on concepts like using python for writing scripts to secure a network.
String
Type:
Click Run, to get the output Tip: If you get an error.
Check you have typed it in
correctly
Input
Type:
Click Run, now enter your name and press ENTER.
Then enter your student no and press ENTER.
Tip: If you get an error.
Check you have typed it in
correctly
Basic: Input and Output
Type:
Activity: Knock Knock Joke 10 Minutes
Write code that:
Outputs:
“Knock Knock”
Input (expect): Who’s there
“Harry”
Input (expect): Harry Who?
“Harry up and gives us good grades”
Outputs:
“Knock Knock”
Input (expect): Who’s there
“Annie”
Input (expect): Annie Who?
“Annie thing you can help us write code?”
Outputs:
“What is your lecturer’s name?”
Input (expect): <name of teacher>
“The best teacher in the world is <name of teacher>
Functions - remember to always use a new block
Output of the text
The brackets indicate a function
The semicolon indicates scope.
Make sure it is indented automatically.
Just press enter after the semicolon.
# is comments
Functions with variables.
Try:
Import - math
Try:
Tip:
Careful what you type.
What the talking marks
and the brackets.
Careful on who you spell
variables.
Wrong variables name
will give you an
error/print something
unexpected.
Import allows files to be imported into your code.
Such that we can use the code variable
Typecast: Int and Float
Try:
What happens when you enter “3.5”?
Now change: w = int(w) To: w = float(w)
Enter “3.5” again.
Tip:
Input from the command line in Python is always a String.
Convert to a whole number use int()
Convert to a decimal number use float()
Python Basic Data Types
■ Integers – whole numbers
■ Float – negative and positive that can have many decimal places.
■ Strings – Characters, Human language literals.
■ Boolean True/False
Activity: Write Code to Calculate Simple Interest
10 Minutes
Write code that display and calculates simple Interest: displays
How much do you want to borrow?
In 30 years, the loan will cost you? I + P
I knew I should have stayed at Mum’s and Dad’s!
Enter P
t = 30
R = 0.05
I = P*R*T
Programming and Secure software development presentation consists of various slides which shed light on concepts like using python for writing scripts to secure a network.
Controls: If … then … else
Tip:
Remember the colon – they represent the start of an
indented block/scope
Let the Python Interpreter do the indentation
(otherwise, you might add an extra space)
Remember Boolean in Python starts with a capital.
Try – changing the “True” to a “False”
Controls: If … then … else if then
Run again and again:
Try “Yes”, “No” and “Maybe”
“YES”, “NO”, “7777”
Controls: If … then … else if then
Run again and again:
Try “Yes”, “No” and “Maybe”
“YES”, “NO”, “7777”
While Loops
Tip:
Got an Infinite Loop?
Go to the command line – where the
Jupyter kernel is running and Ctrl-C.
Use the up arrows to get the last command.
Re-execute jupyer notebook.
For Loops - traditional
Tip:
Got an Infinite Loop?
Go to the command line – where the
Jupyter kernel is running and Ctrl-C.
Use the up arrows to get the last command.
Re-execute Jupyer notebook.
For Loops – “in”
Tip:
Got an Infinite Loop?
Go to the command line – where the
Jupyter kernel is running and Ctrl-C.
Use the up arrows to get the last command.
Re-execute jupyer notebook.
For Loops – and Else
Tip:
Got an Infinite Loop?
Go to the command line – where the
Jupyter kernel is running and Ctrl-C.
Use the up arrows to get the last command.
Re-execute Jupyer notebook.
Practice, Practice, Practice
■ There is loads of help for Python online!
■ Useful Websites:
• https://www.w3schools.com/python
• https://www.geeksforgeeks.org/
• Even ChatGPT is good at Python.
What to Hand in: Your Jupyter Notepad file

More Related Content

Similar to Programming and Secure software development presentation consists of various slides which shed light on concepts like using python for writing scripts to secure a network. (20)

PPTX
Python PPT.pptx
JosephMuez2
 
PDF
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
benhurmaarup
 
PDF
introduction to python programming course
FarhadMohammadRezaHa
 
PDF
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
gustyyrauan
 
PPTX
Python avinash
Avinash Jangir
 
PDF
Python Essentials For Dummies John C Shovic Alan Simpson
cundyfema
 
PPTX
MODULE 1.pptx
KPDDRAVIDIAN
 
ODP
An Intro to Python in 30 minutes
Sumit Raj
 
PPTX
4_Introduction to Python Programming.pptx
Gnanesh12
 
PDF
Python bootcamp - C4Dlab, University of Nairobi
krmboya
 
PPT
Introduction to Python For Diploma Students
SanjaySampat1
 
PPTX
Lecture1_introduction to python.pptx
MohammedAlYemeni1
 
PPTX
2024-25 TYBSC(CS)-PYTHON_PROG_ControlStructure.pptx
sangeeta borde
 
PDF
Tutorial on-python-programming
Chetan Giridhar
 
PDF
Introduction To Programming with Python
Sushant Mane
 
PPTX
lecture 2.pptx
Anonymous9etQKwW
 
PPTX
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
PPTX
Introduction to python for cybersecurity pythonminna
TopeAbdulgafar
 
PDF
An overview on python commands for solving the problems
Ravikiran708913
 
PPTX
Python Demo.pptx
ParveenShaik21
 
Python PPT.pptx
JosephMuez2
 
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
benhurmaarup
 
introduction to python programming course
FarhadMohammadRezaHa
 
Dead Simple Python Idiomatic Python for the Impatient Programmer Jason C. Mcd...
gustyyrauan
 
Python avinash
Avinash Jangir
 
Python Essentials For Dummies John C Shovic Alan Simpson
cundyfema
 
MODULE 1.pptx
KPDDRAVIDIAN
 
An Intro to Python in 30 minutes
Sumit Raj
 
4_Introduction to Python Programming.pptx
Gnanesh12
 
Python bootcamp - C4Dlab, University of Nairobi
krmboya
 
Introduction to Python For Diploma Students
SanjaySampat1
 
Lecture1_introduction to python.pptx
MohammedAlYemeni1
 
2024-25 TYBSC(CS)-PYTHON_PROG_ControlStructure.pptx
sangeeta borde
 
Tutorial on-python-programming
Chetan Giridhar
 
Introduction To Programming with Python
Sushant Mane
 
lecture 2.pptx
Anonymous9etQKwW
 
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Introduction to python for cybersecurity pythonminna
TopeAbdulgafar
 
An overview on python commands for solving the problems
Ravikiran708913
 
Python Demo.pptx
ParveenShaik21
 

Recently uploaded (20)

PPTX
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
PPTX
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
PDF
Learning Exemplar_Technology and Livelihood Education 7 Q1_W2.pdf
mjhiludo16
 
PDF
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
PPTX
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
PPTX
Introduction-to-the-AWS-Solution-Architect.pptx
Prince391830
 
PPTX
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
PDF
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
PDF
AI security AI security AI security AI security
elite44
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
PDF
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
PDF
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
PDF
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
PDF
Strategic Plan New and Completed Templeted
alvi932317
 
PPTX
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
PPTX
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
PPTX
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
PPTX
Meloniusk_Communication_Template_best.pptx
howesix147
 
PDF
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
PDF
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
Learning Exemplar_Technology and Livelihood Education 7 Q1_W2.pdf
mjhiludo16
 
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
Introduction-to-the-AWS-Solution-Architect.pptx
Prince391830
 
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
AI security AI security AI security AI security
elite44
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
Strategic Plan New and Completed Templeted
alvi932317
 
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
Meloniusk_Communication_Template_best.pptx
howesix147
 
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
Ad

Programming and Secure software development presentation consists of various slides which shed light on concepts like using python for writing scripts to secure a network.

  • 2. Unit Guide ■ Unit Description ■ Learning Outcomes ■ Assessments ■ Expectations
  • 3. What is Computer Security? ■ Most developers and operators are concerned with correctness: achieving desired behaviour • A working software • A working banking web site, word processor, blog, • … ■ Security is concerned with preventing undesired behaviour • Considers an enemy/opponent/hacker/adversary who is actively and maliciously trying to circumvent any protective measures you put in place
  • 4. Significant security breaches ■ Marriott International, November 2018 • Stole 500 million customers data, including contact info, passport number, travel information, and credit card numbers of more than 100 million customers. ■ Equifax, July 2017 • Personal information (including Social Security Numbers, birth dates, addresses, and in some cases drivers' license numbers) of 143 million consumers; 209,000 consumers also had their credit card data exposed. ■ Yahoo, September 2016 • 3 billion user accounts are compromised, including names, dates of birth, email addresses, passwords, security questions and answers.
  • 5. Contributing Factors ■ Lack of awareness of threats and risks of information systems • Security measures are often not considered until an Enterprise has been penetrated by malicious users • The situation is getting better, but … ■ (Historical) Reluctance to invest in security mechanisms • The situation is improving • Example: Windows 95 -> Windows 2000 -> Windows XP -> Windows Vista -> Windows 7 -> Windows 8 -> Windows 10 -> Windows 11 • But there exists legacy software • Supply chain security ■ Wide-open network policies • Many Internet sites allow wide-open Internet access
  • 6. Contributing Factors continued ■ Lack of security in TCP/IP protocol suite • Most TCP/IP protocols not built with security in mind • Work is actively progressing within the Internet Engineering Task Force (IETF) ■ Complexity of security management and administration • Security is not just encryption and authentication ■ Software vulnerabilities • Example: buffer overflow vulnerabilities • We need techniques and tools to better software security ■ Hacker skills keep improving • Cyber warfare
  • 7. Compusec + Comsec = Infosec
  • 8. Security Mechanisms ■ Prevention is more fundamental • Detection seeks to prevent by threat of punitive action • Detection requires that the audit trail be protected from alteration ■ Sometime detection is the only option, e.g., • Accountability in proper use of authorized privileges • Modification of messages in a network ■ Security functions are typically made available to users as a set of security services ■ Cryptography underlies (almost) all security mechanisms
  • 9. Application Security ■ Application security usually refers to security after the software is built • Adding more code does not make a faulty software correct • Sandboxing • Network-centric approach • Focus on input checking
  • 10. Why Software Security? ■ Software Security aims to address weaknesses directly
  • 11. HeartBleed ■ SSL/TLS is a core protocol for encrypted communications used by the web ■ Heartbleed is a bug in the commonly used OpenSSL implementation of SSL/TLS, v1.0.1 - 1.0.1f – Discovered in March 2014, it has been in released code since March 2012 ■ A carefully crafted packet causes OpenSSL to read and return portions of a vulnerable server’s memory – Leaking passwords, keys, and other private information
  • 12. Why existing security software didn’t work?! ■ Black box security is incomplete against Heartbleed exploits • Issue is not at the level of system calls or deposited files: nothing the OS or antivirus can do • Basic attack packets could be blocked by IDS, but • “Packet chunking” may bypass basic filters • Exfiltrated data on the encrypted channel; invisible to forensics ■ Software security methods attack the source of the problem: the buggy code
  • 13. Security Assurance ■ How well your security mechanisms guarantee your security policy ■ Everyone wants high assurance ■ High assurance implies high cost • May not be possible ■ Trade-off is needed
  • 14. Security by Obscurity ■ Security by obscurity • If we hide the inner workings of a system it will be secure • E.g., steganography ■ Less and less applicable in the emerging world of vendor-independent open standards ■ Less and less applicable in a world of widespread computer knowledge and expertise
  • 16. Install Python https://www.python.org/ Download and Install the latest Python: Why Python? •Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc). •Python has a simple syntax similar to the English language. (Friendly and Easy to Use) •Python has syntax that allows developers to write programs with fewer lines than some other programming languages. •Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick. •Python can be treated in a procedural way, an object-oriented way or a functional way.
  • 17. Install PIP For Instructions see here: https://www.geeksforgeeks.org/download-and- install-pip-latest-version/ https://pypi.org/project/pip/ Why pip? pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes.
  • 18. Install Jupyter NoteBook For Instructions see here: https://jupyter.org/install Why Jupyter Notebook? A Jupyter Notebook provides you with an easy-to-use, interactive environment a different approach for an IDE with short, explanation and presentation of code, which helps us focus on the meaning. In a Windows/Linux/Mac terminal
  • 20. Run Jupyter NoteBook Windows/Linux/Mac Command Line: jupyter notebook Tip: Use Dark Mode – reduces the light by ~80%, which causes strain on your eyes.
  • 21. Create a Jupyter NoteBook Note: Console – Python Console (accept python commands) Notebook – creates a new Notebook Terminal – OS Terminal (we’ll use this) Text file – a simple ACSII file Markdown File – a Jupyter markdown file, no code, only comments. Python File – python source code file
  • 22. Selecting a Kernel Notebooks are compatible with several programming languages. We’ll always use Python in this class. It can support: Julia, Python, R.
  • 23. Your First Notebook: Hello World Type: print(“Hello World”’) Be careful: Automatic talking marks, punctuation, etc. 1. Type 2. Click Run Success!!
  • 25. Markdown 1. Type the following (Just text) 2. Select Markdown. 3. Run -> Render All Markdown Cells
  • 26. Add New Blocks Copy/Duplicate Block Move the Block UP Move the Block DOWN Delete Block Click Here: Add New Block Below Add New Block Abov
  • 27. Try Some Basic Code Maths Type: Output:
  • 29. String Type: Click Run, to get the output Tip: If you get an error. Check you have typed it in correctly
  • 30. Input Type: Click Run, now enter your name and press ENTER. Then enter your student no and press ENTER. Tip: If you get an error. Check you have typed it in correctly
  • 31. Basic: Input and Output Type:
  • 32. Activity: Knock Knock Joke 10 Minutes Write code that: Outputs: “Knock Knock” Input (expect): Who’s there “Harry” Input (expect): Harry Who? “Harry up and gives us good grades” Outputs: “Knock Knock” Input (expect): Who’s there “Annie” Input (expect): Annie Who? “Annie thing you can help us write code?” Outputs: “What is your lecturer’s name?” Input (expect): <name of teacher> “The best teacher in the world is <name of teacher>
  • 33. Functions - remember to always use a new block Output of the text The brackets indicate a function The semicolon indicates scope. Make sure it is indented automatically. Just press enter after the semicolon. # is comments
  • 35. Import - math Try: Tip: Careful what you type. What the talking marks and the brackets. Careful on who you spell variables. Wrong variables name will give you an error/print something unexpected. Import allows files to be imported into your code. Such that we can use the code variable
  • 36. Typecast: Int and Float Try: What happens when you enter “3.5”? Now change: w = int(w) To: w = float(w) Enter “3.5” again. Tip: Input from the command line in Python is always a String. Convert to a whole number use int() Convert to a decimal number use float()
  • 37. Python Basic Data Types ■ Integers – whole numbers ■ Float – negative and positive that can have many decimal places. ■ Strings – Characters, Human language literals. ■ Boolean True/False
  • 38. Activity: Write Code to Calculate Simple Interest 10 Minutes Write code that display and calculates simple Interest: displays How much do you want to borrow? In 30 years, the loan will cost you? I + P I knew I should have stayed at Mum’s and Dad’s! Enter P t = 30 R = 0.05 I = P*R*T
  • 40. Controls: If … then … else Tip: Remember the colon – they represent the start of an indented block/scope Let the Python Interpreter do the indentation (otherwise, you might add an extra space) Remember Boolean in Python starts with a capital. Try – changing the “True” to a “False”
  • 41. Controls: If … then … else if then Run again and again: Try “Yes”, “No” and “Maybe” “YES”, “NO”, “7777”
  • 42. Controls: If … then … else if then Run again and again: Try “Yes”, “No” and “Maybe” “YES”, “NO”, “7777”
  • 43. While Loops Tip: Got an Infinite Loop? Go to the command line – where the Jupyter kernel is running and Ctrl-C. Use the up arrows to get the last command. Re-execute jupyer notebook.
  • 44. For Loops - traditional Tip: Got an Infinite Loop? Go to the command line – where the Jupyter kernel is running and Ctrl-C. Use the up arrows to get the last command. Re-execute Jupyer notebook.
  • 45. For Loops – “in” Tip: Got an Infinite Loop? Go to the command line – where the Jupyter kernel is running and Ctrl-C. Use the up arrows to get the last command. Re-execute jupyer notebook.
  • 46. For Loops – and Else Tip: Got an Infinite Loop? Go to the command line – where the Jupyter kernel is running and Ctrl-C. Use the up arrows to get the last command. Re-execute Jupyer notebook.
  • 47. Practice, Practice, Practice ■ There is loads of help for Python online! ■ Useful Websites: • https://www.w3schools.com/python • https://www.geeksforgeeks.org/ • Even ChatGPT is good at Python. What to Hand in: Your Jupyter Notepad file