commit bf8a8f965d199ba4d37164888a5e3659f45f367b Author: Mueez Khan <30333942+rzmk@users.noreply.github.com> Date: Thu Mar 25 08:58:09 2021 -0400 Initial upload diff --git a/README.md b/README.md new file mode 100644 index 0000000..1097d34 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Six Quick Python Projects +Based on the tutorial video from [freeCodeCamp by Code With Tomi](https://www.youtube.com/watch?v=SqvVm3QiQVk). \ No newline at end of file diff --git a/bulk_renamer.py b/bulk_renamer.py new file mode 100644 index 0000000..9de1e08 --- /dev/null +++ b/bulk_renamer.py @@ -0,0 +1,13 @@ +import os + +def main(): + i = 0 + path = input("Input a path with png files to rename: ").replace("\\", "/") + "/" + for filename in os.listdir(path): + my_dest = f"img_{str(i)}.{filename.rsplit('.')[-1]}" + my_source = path + filename + my_dest = path + my_dest + os.rename(my_source, my_dest) + i += 1 + +main() \ No newline at end of file diff --git a/countdown.py b/countdown.py new file mode 100644 index 0000000..6a16145 --- /dev/null +++ b/countdown.py @@ -0,0 +1,14 @@ +import time + +def countdown(t): + while t: + mins, secs, = divmod(t, 60) + timer = '{:02d}:{:02d}'.format(mins, secs) + print(timer, end="\r") + time.sleep(1) + t -= 1 + print('Countdown complete!') + +t = input("Enter the time in seconds: ") + +countdown(int(t)) \ No newline at end of file diff --git a/encode_qrcode.py b/encode_qrcode.py new file mode 100644 index 0000000..3ad267d --- /dev/null +++ b/encode_qrcode.py @@ -0,0 +1,13 @@ +import qrcode + +data = input("Type anything you want to decode into a QR code: ") + +qr = qrcode.QRCode(version = 1, box_size=10, border=5) + +qr.add_data(data) + +qr.make(fit=True) + +img = qr.make_image(fill_color = 'blue', back_color = 'white') + +img.save('./testimgs/myqrcode.png') \ No newline at end of file diff --git a/github_profile_picture.py b/github_profile_picture.py new file mode 100644 index 0000000..5028b6e --- /dev/null +++ b/github_profile_picture.py @@ -0,0 +1,9 @@ +import requests +from bs4 import BeautifulSoup as bs + +github_user = input('Input GitHub User: ') +url = f'https://github.com/{github_user}' +r = requests.get(url) +soup = bs(r.content, 'html.parser') +profile_image = soup.find('img', {'alt' : 'Avatar'})['src'] +print(profile_image) \ No newline at end of file diff --git a/password_generator.py b/password_generator.py new file mode 100644 index 0000000..3aa45aa --- /dev/null +++ b/password_generator.py @@ -0,0 +1,14 @@ +import random + +chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?0123456789' + +print('Welcome To Your Password Generator') +number = int(input("How many passwords would you like to generate? ")) +length = int(input("Enter a password length? ")) + +print("\nHere are your passwords:") +for pwd in range(number): + passwords = '' + for c in range(length): + passwords += random.choice(chars) + print(passwords) diff --git a/weather_request.py b/weather_request.py new file mode 100644 index 0000000..aafb25d --- /dev/null +++ b/weather_request.py @@ -0,0 +1,12 @@ +import os +import requests +from pprint import pprint +from decouple import config + +key = config('WEATHER_API_KEY') +city = input("Enter a city: ") +base_url = f"http://api.openweathermap.org/data/2.5/weather?appid={key}&q={city}" +weather_data = requests.get(base_url).json() + +# pprint(weather_data) +print(weather_data['weather'][0]['description']) \ No newline at end of file