On Windows though, I got no clue. If you just search "how to make a firewall on Windows using Python

On Windows though, I got no clue. If you just search "how to make a firewall on Windows using Python" you should find something
13 Replies
not rob
not rob9mo ago
Even then it's still up for definition what we consider a firewall, is it just the software solution on an endpoint? Is it actual hardware like the stuff by Cisco? Good answer tho
Dumb Bird
Dumb BirdOP9mo ago
As he mentions creating it with Python I assume he means a piece of software that monitors incoming and outgoing network traffic. At the very core all a firewall is:
A firewall is a network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on a defined set of security rules.
From what is a firewall? - Cisco
Cisco
What Is a Firewall?
A firewall is a network security device that monitors traffic to or from your network. It allows or blocks traffic based on a defined set of security rules.
Dumb Bird
Dumb BirdOP9mo ago
Regardless of where it's implemented this is still a baseline that needs to be implemented. Well regardless @Adam if you want some more help it would be nice if you could elaborate a bit!
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
not rob
not rob9mo ago
Very nice'
Dumb Bird
Dumb BirdOP9mo ago
def is_even(number: int) -> bool:
return (number % 2) == 0


collatz = int(input("Enter INTEGER: "))

with open('Collatz.txt', 'w') as f:
while collatz != 1:
f.write(str(collatz) + '\n')

if is_even(collatz):
collatz = int(collatz / 2)
else:
collatz = int(collatz * 3 + 1)

f.write('1 - END OF CONJECTURE')
def is_even(number: int) -> bool:
return (number % 2) == 0


collatz = int(input("Enter INTEGER: "))

with open('Collatz.txt', 'w') as f:
while collatz != 1:
f.write(str(collatz) + '\n')

if is_even(collatz):
collatz = int(collatz / 2)
else:
collatz = int(collatz * 3 + 1)

f.write('1 - END OF CONJECTURE')
Here is a subjectively better way to write you code Setting sys.stdout like that is considered hackish. So instead I opt to use the proper function for writing text to a file. I also changed up your isEven function to is_even. As the Python style guide states that functions should be snake_case. I also changed the function to just return the result of (number % 2) == 0 instead of using an if statment I remove your usage of the variable test as in Python an object is still able to reference it's old value before it gets changed. Which is why I'm able to do things like collatz = int(collatz / 2) I also removed your if statment checking if collatz == 1, as we know it equals one. We know this because our while loop ensures this.
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Dumb Bird
Dumb BirdOP9mo ago
No problem just figured I'd rewrite it to give you an idea of other ways of writing Python
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
not rob
not rob9mo ago
👋
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Dumb Bird
Dumb BirdOP9mo ago
In the terminal?
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?