Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Password Generator #455

Merged
merged 3 commits into from
Oct 3, 2021
Merged
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
3 changes: 2 additions & 1 deletion Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@


<a class="box-item" href="https://github.com/fineanmol"><span>Anmol Agarwal</span></a>

<a class="box-item" href="https://github.com/Amitava123"><span>Amitava Mitra</span></a>
<a class="box-item" href="https://github.com/philson-philip"><span>Philson Philip</span></a>
<a class="box-item" href="https://github.com/SHIV1003"><span>Shivam Goyal</span></a>
Expand Down Expand Up @@ -583,6 +582,7 @@
<a class="box-item" href="https://github.com/a-ayush19"><span>Ayush Awasthi</span></a>
<a class="box-item" href="https://github.com/SamarthSawhney"><spann>Samarth Sawhney</span></a>
<a class="box-item" href="https://github.com/highflyer910"><span>Thea M.</span></a>

<a class="box-item" href="https://github.com/vishnuramv"><span>Vishnu Ram V</span></a>

<a class="box-item" href="https://github.com/nyctonio"><span>Ritesh Kumar</span></a>
Expand All @@ -591,6 +591,7 @@
<a class="box-item" href="https://github.com/PrajaktaSathe"><span>Prajakta Sathe</span></a>
<a class="box-item" href="https://github.com/Kaustubh251002"><span>Kaustubh Mishra</span></a>
<a class="box-item" href="https://github.com/priyanshu-28"><span>Priyanshu Pathak</span></a>
<a class="box-item" href="https://github.com/amazing-AK"><span>Aditya Krishna</span></a>



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import random

# Binary Search


def binarySearch(sortedList, key, start, end):
if start <= end:
middleIndex = (start + end) // 2
middleElement = sortedList[middleIndex]

if middleElement == key:
return middleIndex
elif middleElement < key:
location = binarySearch(sortedList, key, middleIndex + 1, end)
else:
location = binarySearch(sortedList, key, start, middleIndex - 1)

return location

return -1


myList = random.sample(range(0, 1000), 10)
target = int(input('Enter target: '))
location = binarySearch(myList, target, 0, len(myList) - 1)
print(f'Element found at index {location}.')


# Old version
# start,end
def binarySearch(key, start, end):
# If start and end are adjacent elements, element does not exist
if end == start + 1:
return -1
middleElementIndex = (start + end) // 2
middleElement = myList[middleElementIndex]
if key == middleElement:
return middleElementIndex
if key >= middleElement:
start = middleElementIndex
x = binarySearch(key, start, end)
else:
end = middleElementIndex
x = binarySearch(key, start, end)
return x


myList = [1, 2, 3, 4, 5, 12, 20, 30, 40, 45, 50, 70]
elementToBeFound = 5
print(f'List: {myList}')
x = binarySearch(elementToBeFound, 0, len(myList) - 1)
print(f'{elementToBeFound} found at index: {x}')
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import string
import random

allLetters = string.ascii_letters
allNumbers = string.digits
allSymbols = string.punctuation

allCharacters = allLetters + allNumbers + allSymbols
passwordLength = 20


temp = random.sample(allCharacters, passwordLength)
password = "".join(temp)


print(f"Generated Password: {password}")