Skip to content

Hello world test #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/PythonforCybersecurity-example.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ShoppingList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ Milk
Break
Bananas
Eggs

Apples
Tomatoes
Cake
6 changes: 4 additions & 2 deletions end/CH02/HelloWorld.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python3
# A simple "Hello World" script in python
# Created by Ed Goad, 2/3/2021
print("Hello World")
# Created by Quentin Athula, 3/8/2025

your_name = input("what is your name? ")
print("Hello {0}".format(your_name))
7 changes: 6 additions & 1 deletion end/CH02/HelloWorld2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env python3
# A simple "Hello World" script in python with Inputs
# Created by Ed Goad, 2/3/2021
# Created by Quentin Athula, 3/8/2025

your_name = input("What is your name? ")
print("Hello {0}".format(your_name))
print(f"Hello {your_name}")
print("Hello " + your_name)
print("Hello", your_name)
message = "Hello" + " " + your_name
print(message)
13 changes: 7 additions & 6 deletions end/CH02/SimpleCalculator.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python3
# A simple calculator to show math and conditionals
# Created by Ed Goad, 2/3/2021
#!/user/bin/env python3
# A simple calculator script in python
# Created by Quentin Athula, 3/9/2025

# Get inputs first
# Note we are casting the numbers as "float", we could also do "int"
# Get input from the user
# Note we are casting the numbers as "float", we could also cast them as "int"
first_num = float(input("What is the first number: "))
activity = input("What activity? ( + - * / ) ")
second_num = float(input("What is the second number: "))

# depending on the selected activity, perform an action
# depending on the selected activity, perform the calculation
if activity == "+":
print(first_num + second_num)
if activity == "-":
Expand All @@ -17,3 +17,4 @@
print(first_num * second_num)
if activity == "/":
print(first_num / second_num)

6 changes: 3 additions & 3 deletions end/CH03/pinger1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#!/usr/bin/venv python3
# First example of pinging from Python
# By Ed Goad
# 2/27/2021
# By Quentin Athula
# 3/15/2025

# import necessary Python modules
import platform
Expand Down
16 changes: 8 additions & 8 deletions end/CH03/pinger2.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
#!/usr/bin/venv python3
# Second example of pinging from Python
# By Ed Goad
# 2/27/2021
# By Quentin Athula
# 3/15/2025

# import necessary Python modules
import platform
import os

# Assign IP to ping to a variable
ip = "127.0.0.1"
# Determine the currrent OS
currrent_os = platform.system().lower()
if currrent_os == "windows":
# Build our ping command for Windows
ping_cmd = f"ping -n 1 -w 2 {ip} > nul"
# Determine the current OS
current_os = platform.system().lower()
if current_os == "darwin":
# Build our ping command for darwin
ping_cmd = f"ping -n 1 -w 2 {ip} > /dev/null 2>&1"
else:
# Build our ping command for other OSs
ping_cmd = f"ping -c 1 -w 2 {ip} > /dev/null 2>&1"
Expand Down
10 changes: 5 additions & 5 deletions end/CH03/pinger3.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#!/usr/bin/env python3
# Third example of pinging from Python
# By Ed Goad
# 2/27/2021
# By Quentin Athula
# 3/16/2025

# import necessary Python modules
import platform
import os

# Define the prefix to begin pinging
ip_prefix = "192.168.0."
# Determine the currrent OS
currrent_os = platform.system().lower()
# Determine the current OS
current_os = platform.system().lower()
# Loop from 0 - 254
for final_octet in range(254):
# Assign IP to ping to a variable
# Adding 1 to final_octet because loop starts at 0
ip = ip_prefix + str(final_octet + 1)
if currrent_os == "windows":
if current_os == "windows":
# Build our ping command for Windows
ping_cmd = f"ping -n 1 -w 2 {ip} > nul"
else:
Expand Down
5 changes: 3 additions & 2 deletions start/CH02/HelloWorld.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/.venv python3
# A simple "Hello World" script in python
# Created
# Created by Quentin Athula 3/16/2025
print("hello world")
4 changes: 4 additions & 0 deletions start/CH02/HelloWorld1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/user/bin/.venv/ python3
# A sample "Check that the IDLE is working" script in python
# Created by Quentin Athula 3/22/2025
print("This is a sample to check that the IDE is working")
9 changes: 5 additions & 4 deletions start/CH02/HelloWorld2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env python3
# A simple "Hello World" script in python with Inputs
# Created
# Created by Quentin Athula 3/22/2025

your_name = input("What is your name? ")
print("Hello {0} ".format(your_name))


# Suggestion, build out 1 line at a time
# Once multiple print statemetns exist, put a breakpoint at first print line
# Then walk through as an example of "debugging"
10 changes: 9 additions & 1 deletion start/CH02/HelloWorld3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#!/usr/bin/env python3
# A more complex "Hello World" script in python with Inputs
# Created
# Created by Quentin Athula 3/22/2025

your_name = input("What is your name? ")
print("Hello {0} ".format(your_name))
print(f"Hello {your_name}")
print("Hello" + your_name)
print("Hello", your_name)
message = "Hello" + " " + your_name
print(message)
16 changes: 15 additions & 1 deletion start/CH03/pinger1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#!/usr/bin/env python3
# First example of pinging from Python
# By
# By Quentin Athula
# 4/22/2025

# import necessary python modules
import platform
import os

# Assign IP address to ping to a variable
ip = "127.0.0.1"
# Build the command to ping the IP address
ping_cmd = f"ping -c 1 -w 2 {ip} > /dev/null 2>&1"
# Execute command and capture exit code
exit_code = os.system(ping_cmd)
# print the result to the console
print(exit_code)
27 changes: 24 additions & 3 deletions start/CH03/pinger2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
#!/usr/bin/env python3
# Second example of pinging from Python
# By
#!/user/bin/.venv/ python3
# A second example of pinging from python
# Created by Quentin athula
# 4/22/2025

# import necessary python modules
import platform
import os

# Assign IP address to ping to a variable
ip = "127.0.0.1"
# Determine the current operating system
current_os = platform.system() . lower()
if current_os == "windows":
# Build our ping command for windows
ping_cmd = f"ping -n 1 -w 2 {ip} > nul"
else:
# Build our ping command for other operating systems
ping_cmd = f"ping -c 1 -w 2 {ip} > /dev/null 2>&1"

# Execute command and capture exit code
exit_code = os.system(ping_cmd)
# print the result to the console
print(exit_code)
31 changes: 29 additions & 2 deletions start/CH03/pinger3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
#!/usr/bin/env python3
#!/user/bin/.vnv/ python3
# Third example of pinging from Python
# By
# By Quentin Athula
# 4/22/2025

# import necessary python modules
import platform
import os

# Define a function to ping an IP address
ip_prefix = "192.168.1."
# determine the current operating system
current_os = platform.system(). lower()
# Loop from 0 - 254
for final_octet in range(254):
# Assign IP to ping to a variable
# Adding 1 to final_octet because loop starts at 0
ip = ip_prefix + str(final_octet + 1)
if current_os == "windows":
# Build our ping command for windows
ping_cmd = f"ping -n 1 -w 2 {ip} > nul"
else:
# Build our ping command for other operating systems
ping_cmd = f"ping -c 1 -w 2 {ip} > /dev/null 2>&1"

# Execute command and capture exit code
exit_code = os.system(ping_cmd)
# print results to console only if successful
if exit_code == 0:
print("{0} is online" .format(ip))
37 changes: 36 additions & 1 deletion start/CH03/pinger4.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
#!/usr/bin/env python3
# Fourth example of pinging from Python
# By
# By Quentin athula
# 4/22/2025

# import necessary python modules
import platform
import os

def ping_host(ip):
# Determine the current operating system
current_os = platform.system().lower()
if current_os == "windows":
# Build our ping command for windows
ping_cmd = f"ping -n 1 -w 2 {ip} > nul"
else:
# Build our ping command for other operating systems
ping_cmd = f"ping -c 1 -w 2 {ip} > /dev/null 2>&1"

# Execute command and capture exit code
exit_code = os.system(ping_cmd)
return exit_code

# Define the prefix to begin pinging
ip_prefix = "192.168.1."

# loop from 0 - 254
for final_octet in range(254):
# Assign IP to ping to a variable
# Adding 1 to final_octet because loop starts at 0
ip = ip_prefix + str(final_octet + 1)

# call the ping_host function and capture the return value
exit_code = ping_host(ip)

# print results to console only if successful
if exit_code == 0:
print("{0} is online" .format(ip))