Skip to content

Commit e59608d

Browse files
authored
Added files via upload.
1 parent c610e3a commit e59608d

File tree

5 files changed

+84
-0
lines changed

5 files changed

+84
-0
lines changed

Dictionary App/Dictionary App.py

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import json
2+
from difflib import get_close_matches
3+
4+
# Loading data
5+
# Dict type
6+
data = json.load(open("data.json"))
7+
8+
# Returning the definition of the word
9+
# Main program logic
10+
def meaning(word):
11+
word = word.lower()
12+
13+
if word in data:
14+
return data[word]
15+
16+
elif word.title() in data:
17+
return data[word.title()]
18+
19+
elif word.upper() in data:
20+
return data[word.upper()]
21+
22+
elif len(get_close_matches(word, data.keys())) > 0:
23+
yn = input("Did you mean \"%s\" instead ? Press Y for yes, or N for no: " % get_close_matches(word, data.keys())[0])
24+
25+
if yn == "Y":
26+
return data[get_close_matches(word, data.keys())[0]]
27+
elif yn == "N":
28+
return "No such word! Please double check it :)"
29+
else:
30+
return "We didn't understand your query."
31+
32+
else:
33+
return "No such word! Please double check it :)"
34+
35+
# Main user input
36+
word = input("Enter word: ")
37+
38+
# Storing the output in a variable for formatting
39+
output = meaning(word)
40+
41+
# Output formatting
42+
if type(output) == list:
43+
for item in output:
44+
print(f"-> {item}")
45+
else:
46+
print(output)

Dictionary App/data.json

+1
Large diffs are not rendered by default.

Password Generator.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import random
2+
3+
passlen = int(input("Enter the length of the Password:"))
4+
5+
s ="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?"
6+
7+
p = "".join(random.sample(s,passlen))
8+
print(p)

System check.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import platform
2+
3+
print("="*40, "System Information", "="*40)
4+
uname = platform.uname()
5+
print(f"system: {uname.system}")
6+
print(f"Node Name: {uname.node}")
7+
print(f"Release: {uname.release}")
8+
print(f"Version: {uname.version}")
9+
print(f"Machine: {uname.machine}")
10+
print(f"Processor: {platform.processor()}")
11+
print("="*100)

TextPro.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def sentence_maker(phrase):
2+
introgetory = ("How", "When", "Why", "Who", "Where")
3+
capitalize = phrase.capitalize()
4+
if capitalize.startswith(introgetory):
5+
return "{}?".format(capitalize)
6+
else:
7+
return "{}.".format(capitalize)
8+
9+
result = []
10+
11+
while True:
12+
user_input = input("Say something: ")
13+
if user_input == "end":
14+
break
15+
else:
16+
result.append(sentence_maker(user_input))
17+
18+
print(" ".join(result))

0 commit comments

Comments
 (0)