Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 74ae4c4

Browse files
author
ravishhankar
committed
Merged conflicts
2 parents 624647b + 760b764 commit 74ae4c4

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

projects/Random password generator/random_password_gen.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import random
22
import math
3+
<<<<<<< HEAD
34
alpha = "abcdefghijklmnopqrstuvwxyz"
45
num = "0123456789"
56
special = "@#$%&*"
@@ -40,3 +41,51 @@ def generate_pass(length, array, is_alpha=False):
4041
for i in password:
4142
gen_password = gen_password + str(i)
4243
print(gen_password)
44+
=======
45+
alpha="abcdefghijklmnopqrstuvwxyz"
46+
num="0123456789"
47+
special="@#$%&*"
48+
49+
#pass_len=random.randint(8,13) #without User INput
50+
pass_len=int(input("Enter Password Length"))
51+
52+
#length of password by 50-30-20 formula
53+
alpha_len=pass_len//2
54+
num_len=math.ceil(pass_len*30/100)
55+
special_len=pass_len-(alpha_len+num_len)
56+
57+
58+
password=[]
59+
60+
def generate_pass(length,array,is_alpha=False):
61+
62+
for i in range(length):
63+
index=random.randint(0,len(array)-1)
64+
character=array[index]
65+
if is_alpha==True:
66+
67+
case=random.randint(0,1)
68+
if case==1:
69+
character=character.upper()
70+
71+
password.append(character)
72+
73+
#alpha password
74+
generate_pass(alpha_len,alpha,True)
75+
#numeric password
76+
generate_pass(num_len,num)
77+
#special Character password
78+
generate_pass(special_len,special)
79+
80+
#suffle the generated password list
81+
random.shuffle(password)
82+
83+
#convert List To string
84+
gen_password=""
85+
for i in password:
86+
gen_password=gen_password+str(i)
87+
88+
print(gen_password)
89+
90+
91+
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42

projects/organized download folder with different categories/file-sortor.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import shutil
3+
<<<<<<< HEAD
34

45
os.chdir("E:\\downloads")
56
# print(os.getcwd())
@@ -8,11 +9,21 @@
89
files = os.listdir()
910

1011
# list of extension (You can add more if you want)
12+
=======
13+
os.chdir("E:\downloads")
14+
#print(os.getcwd())
15+
16+
#check number of files in directory
17+
files = os.listdir()
18+
19+
#list of extension (You can add more if you want)
20+
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
1121
extentions = {
1222
"images": [".jpg", ".png", ".jpeg", ".gif"],
1323
"videos": [".mp4", ".mkv"],
1424
"musics": [".mp3", ".wav"],
1525
"zip": [".zip", ".tgz", ".rar", ".tar"],
26+
<<<<<<< HEAD
1627
"documents": [".pdf", ".docx", ".csv",
1728
".xlsx", ".pptx", ".doc", ".ppt", ".xls"],
1829
"setup": [".msi", ".exe"],
@@ -22,6 +33,18 @@
2233

2334

2435
# sort to specific folder depend on extenstions
36+
=======
37+
"documents": [".pdf", ".docx", ".csv", ".xlsx", ".pptx", ".doc", ".ppt", ".xls"],
38+
"setup": [".msi", ".exe"],
39+
"programs": [".py", ".c", ".cpp", ".php", ".C", ".CPP"],
40+
"design": [".xd", ".psd"]
41+
42+
43+
}
44+
45+
46+
#sort to specific folder depend on extenstions
47+
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
2548
def sorting(file):
2649
keys = list(extentions.keys())
2750
for key in keys:
@@ -31,16 +54,28 @@ def sorting(file):
3154
return key
3255

3356

57+
<<<<<<< HEAD
3458
# iterate through each file
59+
=======
60+
#iterat through each file
61+
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
3562
for file in files:
3663
dist = sorting(file)
3764
if dist:
3865
try:
3966
shutil.move(file, "../download-sorting/" + dist)
67+
<<<<<<< HEAD
4068
except Exception:
69+
=======
70+
except:
71+
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
4172
print(file + " is already exist")
4273
else:
4374
try:
4475
shutil.move(file, "../download-sorting/others")
76+
<<<<<<< HEAD
4577
except Exception:
78+
=======
79+
except:
80+
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
4681
print(file + " is already exist")

0 commit comments

Comments
 (0)