Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 39 additions & 0 deletions currencyconverter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import requests

def convert_curr():
init_currency = input("Enter the initial currency: ")
target_currency = input("Enter the target currency: ")

while True:
try:
amount = float(input('Enter the amount: '))
except:
print('The amount needs to be numeric')
continue

if not amount > 0:
print('Amount needs to be greater than 0')
continue
else:
break

url = f"https://api.apilayer.com/fixer/convert?to={target_currency}&from={init_currency}&amount={amount}"

payload = {}
headers = {
"apikey": "DEFPqH61PuSInln1v9M5q9e7eO2f6zet"
}

response = requests.request("GET", url, headers=headers, data=payload)
status_code = response.status_code

if status_code != 200:
result = response.json()
print('Error response: ' + str(result))
quit()

result = response.json()
print('Conversion Result: ' + str(result['result']))

if __name__ == '__main__':
convert_curr()
74 changes: 74 additions & 0 deletions pswdchecker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import string
import getpass

def check_pwd():
password = getpass.getpass("Enter Password: ")
strength = 0
remarks = ''
lower_count = upper_count = num_count = wspace_count = special_count = 0

for char in list(password):
if char in string.ascii_lowercase:
lower_count += 1
elif char in string.ascii_uppercase:
upper_count +=1
elif char in string.digits:
num_count += 1
elif char == ' ':
wspace_count +=1
else:
special_count +=1

if lower_count >= 1:
strength +=1
if upper_count >= 1:
strength +=1
if num_count >= 1:
strength +=1
if wspace_count>=1:
strength +=1
if special_count>=1:
strength +=1

if strength == 1:
remarks = "Very Bad Password!!! Change ASAP"
elif strength == 2:
remarks = "Not A Good Password!!! Change ASAP"
elif strength ==3:
remarks = "It's a weak password, consider changing"
elif strength == 4:
remarks = "It's a hard password, but can be better"
elif strength == 5:
remarks = "A very strong password"

print('Your password has: ')
print(f"{lower_count} lowercase characters")
print(f"{upper_count} uppercase characters")
print(f"{num_count} numeric characters")
print(f"{wspace_count} whitespace characters")
print(f"{special_count} special characters")

print(f"Password Strength:{strength}")
print(f"Hint: {remarks}")

def ask_pwd(another_pwd=False):
valid = False
if another_pwd:
choice=input('Do you want to enter another pwd (y/n): ')
else:
choice=input('Do you want to check pwd (y/n): ')

while not valid:
if choice.lower() == 'y':
return True
elif choice.lower() == 'n':
return False
else:
print('Invalid, Try Again')

if __name__ == '__main__':
print('+++ welcome to PWD checker +++')
ask_pw = ask_pwd()
while check_pwd:
check_pwd()
ask_pw = ask_pwd(True)