diff --git a/Age-Calculator-GUI/age_calc_gui.py b/Age-Calculator-GUI/age_calc_gui.py index 26b97116f5..27c1f9315b 100644 --- a/Age-Calculator-GUI/age_calc_gui.py +++ b/Age-Calculator-GUI/age_calc_gui.py @@ -1,4 +1,5 @@ # import libraries + import tkinter as tk from datetime import date @@ -44,17 +45,69 @@ def run(self): self.dayEntry = tk.Entry(self.master, textvariable=dayValue, relief="solid") self.dayEntry.grid(row=4, column=1, padx=10, pady=10) + + def check_year(): + #simple method to check the validity of a user input birth year + self.statement.destroy() + today = date.today() + try: + year = int(self.yearEntry.get()) + if today.year - year < 0: + self.statement = tk.Label({nameValue.get()}'s" age cannot be negative.", font="courier 10", bg="lightblue") + self.statement.grid(row=6, column=1, pady=15) + return False + else: + return True + except Exception as e: + self.statement = tk.Label({nameValue.get()}'s" birth year cannot parse to int.", font="courier 10", bg="lightblue") + self.statement.grid(row=6, column=1, pady=15) + return False + + def check_month(): + #simple method to check the validity of a user input birth month + self.statement.destroy() + try: + month = int(self.monthEntry.get()) + if month < 0 or month> 12: + self.statement = tk.Label(text=f"{nameValue.get()}'s birth month is outside 1-12.", font="courier 10", bg="lightblue") + self.statement.grid(row=6, column=1, pady=15) + return False + else: + return True + except Exception as e: + self.statement = tk.Label(text=f"{nameValue.get()}'s birth month cannot parse to int.", font="courier 10", bg="lightblue") + self.statement.grid(row=6, column=1, pady=15) + return False + + def check_day(): + #simple method to check the validity of a user input birth day + self.statement.destroy() + try: + day = int(self.dayEntry.get()) + if day < 0 or day> 31: + self.statement = tk.Label(text=f"{nameValue.get()}'s birth day is outside 1-31.", font="courier 10", bg="lightblue") + self.statement.grid(row=6, column=1, pady=15) + return False + else: + return True + except Exception as e: + self.statement = tk.Label(text=f"{nameValue.get()}'s birth month cannot parse to int.", font="courier 10", bg="lightblue") + self.statement.grid(row=6, column=1, pady=15) + return False + # defining the function for calculating age def ageCalc(): self.statement.destroy() today = date.today() - birthDate = date(int(self.yearEntry.get()), int( - self.monthEntry.get()), int(self.dayEntry.get())) - age = today.year - birthDate.year - if today.month < birthDate.month or today.month == birthDate.month and today.day < birthDate.day: - age -= 1 - self.statement = tk.Label({nameValue.get()}'s" age is {age}.", font="courier 10", bg="lightblue") - self.statement.grid(row=6, column=1, pady=15) + #adding some stuff for checking validity of inputs + if check_year() and check_month() and check_day(): + birthDate = date(int(self.yearEntry.get()), int( + self.monthEntry.get()), int(self.dayEntry.get())) + age = today.year - birthDate.year + if today.month < birthDate.month or today.month == birthDate.month and today.day < birthDate.day: + age -= 1 + self.statement = tk.Label({nameValue.get()}'s" age is {age}.", font="courier 10", bg="lightblue") + self.statement.grid(row=6, column=1, pady=15) # create a button for calculating age self.button = tk.Button(, font="courier 12 bold", fg="white", bg="dodgerblue", command=ageCalc) @@ -67,4 +120,4 @@ def ageCalc(): if __name__ == '__main__': age_calc = App() age_calc.run() - + \ No newline at end of file diff --git a/Convert-to-JPG/readme.md b/Convert-to-JPG/readme.md new file mode 100644 index 0000000000..a19e243652 --- /dev/null +++ b/Convert-to-JPG/readme.md @@ -0,0 +1,19 @@ + +# Convert2jpg + +It converts any photo format to JPG format photo. + + +## Setup instructions + +`pip install Pillow` + +`python convert2jpg.py image.png` + +## Output + +image in jpg format + +## Author(s) + +[Avinash Kr. Ranjan](https://github.com/avinashkranjan) diff --git a/Convert-to-JPG/readme.txt b/Convert-to-JPG/readme.txt deleted file mode 100644 index 0929d3874f..0000000000 --- a/Convert-to-JPG/readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -This is a python script which converts photos to jpg format -If you want to run it the command is : - $ convert2jpg test.png - - - -thanks have a nice automation day \ No newline at end of file diff --git a/Convert2jpg/README.md b/Convert2jpg/README.md deleted file mode 100644 index a5d6585819..0000000000 --- a/Convert2jpg/README.md +++ /dev/null @@ -1,16 +0,0 @@ -
$ convert2jpg test.png
-
-#### By [Avinash Kr. Ranjan](https://github.com/avinashkranjan)
\ No newline at end of file
diff --git a/Fibonacci_Sequence_Generator/Fibonacci.py b/Fibonacci_Sequence_Generator/Fibonacci.py
new file mode 100644
index 0000000000..07dfa12fa2
--- /dev/null
+++ b/Fibonacci_Sequence_Generator/Fibonacci.py
@@ -0,0 +1,23 @@
+def Fibbo_Sequence_Generator():
+ # Generates a fibonacci sequence with the size of ngi
+ runFib = True
+ while(runFib):
+ n = int(input('How many numbers do you need? '))
+ if n> 0 :
+ runFib = False
+ series = [1]
+
+ while len(series) < n: + if len(series) == 1: + series.append(1) + else: + series.append(series[-1] + series[-2]) + + for i in range(len(series)): # Convert the numbers to strings + series[i] = str(series[i]) + else: + print('enter a valid number') + + return(', '.join(series)) # Return the sequence seperated by commas + +print(Fibbo_Sequence_Generator()) \ No newline at end of file diff --git a/Fibonacci_Sequence_Generator/README.md b/Fibonacci_Sequence_Generator/README.md new file mode 100644 index 0000000000..87e2bce104 --- /dev/null +++ b/Fibonacci_Sequence_Generator/README.md @@ -0,0 +1,10 @@ +# Python Fibonacci Sequence Generator +This python script will ask you how many numbers do you need to see in the Fibonacci Sequence and generates the sequence based on your input. + +## Requirement +Python 3.xx + +## Running the script +```bash +python Fibonacci.py +``` \ No newline at end of file diff --git a/Plagiarism_detector/README.md b/Plagiarism_detector/README.md new file mode 100644 index 0000000000..143d93b493 --- /dev/null +++ b/Plagiarism_detector/README.md @@ -0,0 +1,8 @@ +# Plagiarism Detector +This script helps to detect the amount (percentage) of similarity between 2 files . + +## Input +It takes paths of 2 files you want to compare as input + +## Output +It returns the percentage of similarity between the 2 files \ No newline at end of file diff --git a/Plagiarism_detector/plagiarism.py b/Plagiarism_detector/plagiarism.py new file mode 100644 index 0000000000..ed096a9bb5 --- /dev/null +++ b/Plagiarism_detector/plagiarism.py @@ -0,0 +1,13 @@ +from difflib import SequenceMatcher + +def similarity_per(f1,f2): + with open(f1,errors="ignore") as file1,open(f2,errors="ignore") as file2: + file1_data=file1.read() + file2_data=file2.read() + similarity=SequenceMatcher(None,file1_data,file2_data).ratio() + print(f"these 2 files are {similarity*100} % similar") + +if __name__ == '__main__': + f1=input("file 1 path :") + f2=input("file 2 path :") + similarity_per(f1,f2) diff --git a/Traffic-Sign-Detection/requirements.txt b/Traffic-Sign-Detection/requirements.txt index 1857d51f91..caa651861f 100644 --- a/Traffic-Sign-Detection/requirements.txt +++ b/Traffic-Sign-Detection/requirements.txt @@ -55,7 +55,7 @@ nbclient==0.5.1 nbconvert==6.5.1 nbformat==5.1.2 nest-asyncio==1.4.3 -networkx==2.5 +networkx==2.6 notebook==6.4.12 numba==0.52.0 numpy==1.22.0 @@ -116,7 +116,7 @@ tornado==6.1 tqdm==4.56.0 traitlets==5.0.5 typing-extensions==3.7.4.3 -urllib3==1.26.2 +urllib3==1.26.5 wc webencodings==0.5.1 Werkzeug==1.0.1 diff --git a/imageWatermarker/README.md b/imageWatermarker/README.md new file mode 100644 index 0000000000..562a28ac18 --- /dev/null +++ b/imageWatermarker/README.md @@ -0,0 +1,13 @@ +## Python script to watermark your images + +in the `main.py` file edit the following items: + +```bash + "",
+ "