Skip to content
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

Suggestions #2

Open
milliorn opened this issue Sep 7, 2022 · 0 comments
Open

Suggestions #2

milliorn opened this issue Sep 7, 2022 · 0 comments

Comments

@milliorn
Copy link

milliorn commented Sep 7, 2022

leapyearchecker.py -> https://stackoverflow.com/a/11622584/11986604

random password generator.py -> This line of code can replace string and you just change the values to use whatever codes you want.

alphabet = list(map(chr, range(33, 123)))
import random

alphabet = list(map(chr, range(33, 123)))


def generate_password():
    password_len = int(input("Enter password length:"))

    random.shuffle(alphabet)
    password = []

    for x in range(password_len):
        password.append(random.choice(alphabet))

    random.shuffle(password)
    password = "".join(password)
    print(password)


generate_password()

site connectivity checker.py

import urllib.request as urlib


def site_checker(url):
    print("Checking connectivity ")
    response = None
    try:
        response = urlib.urlopen(url)
        print("Connected to", url, "successfully")
        print("The response code was: ", response.getcode())
    except Exception as ex:
        print(ex)
    finally:
        if response is not None:
            response.close()


input_url = input("Enter the url you wish to check connectivity: ")
site_checker(input_url)

This will make sure to give an error code if one pops up. Also, it's important to close connections when we are done.

@milliorn milliorn changed the title leap year checker.py Suggestions Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant