Skip to content

Commit b4a4af7

Browse files
Merge branch 'master' into patch-1
2 parents d272980 + 0e0666e commit b4a4af7

File tree

77 files changed

+35670
-291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+35670
-291
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
.idea
22
*.pyc
3+
string=sorted(input())
4+
lower=""
5+
even=""
6+
odd=""
7+
upper=""
8+
for i in string:
9+
if i.islower():
10+
lower+=i
11+
elif i.isupper():
12+
upper+=i
13+
elif int(i)%2==0:
14+
even+=i
15+
else:
16+
odd+=i
17+
print(lower+upper+odd+even)

Assembler/GUIDE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Guide for Python-Assembler
1+
# Guide for Python_Assembler
22

33
### Register
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#The project automates calls for people from the firebase cloud database and the schedular keeps it running and checks for entries
2+
#every 1 hour using aps scedular
3+
#The project can be used to set 5 min before reminder calls to a set of people for doing a particular job
4+
import os
5+
from firebase_admin import credentials, firestore, initialize_app
6+
from datetime import datetime,timedelta
7+
import time
8+
from time import gmtime, strftime
9+
import twilio
10+
from twilio.rest import Client
11+
#twilio credentials
12+
acc_sid=""
13+
auth_token=""
14+
client=Client(acc_sid, auth_token)
15+
16+
#firebase credentials
17+
#key.json is your certificate of firebase project
18+
cred = credentials.Certificate('key.json')
19+
default_app = initialize_app(cred)
20+
db = firestore.client()
21+
database_reference = db.collection('on_call')
22+
23+
#Here the collection name is on_call which has documents with fields phone , from (%H:%M:%S time to call the person),date
24+
25+
#gets data from cloud database and calls 5 min prior the time (from time) alloted in the database
26+
def search():
27+
28+
calling_time = datetime.now()
29+
one_hours_from_now = (calling_time + timedelta(hours=1)).strftime('%H:%M:%S')
30+
current_date=str(strftime("%d-%m-%Y", gmtime()))
31+
docs = db.collection(u'on_call').where(u'date',u'==',current_date).stream()
32+
list_of_docs=[]
33+
for doc in docs:
34+
35+
c=doc.to_dict()
36+
if (calling_time).strftime('%H:%M:%S')<=c['from']<=one_hours_from_now:
37+
list_of_docs.append(c)
38+
print(list_of_docs)
39+
40+
while(list_of_docs):
41+
timestamp=datetime.now().strftime('%H:%M')
42+
five_minutes_prior= (timestamp + timedelta(minutes=5)).strftime('%H:%M')
43+
for doc in list_of_docs:
44+
if doc['from'][0:5]==five_minutes_prior:
45+
phone_number= doc['phone']
46+
call = client.calls.create(
47+
to=phone_number,
48+
from_="add your twilio number",
49+
url="http://demo.twilio.com/docs/voice.xml"
50+
)
51+
list_of_docs.remove(doc)
52+
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#schedular code for blocking schedular as we have only 1 process to run
2+
3+
from apscheduler.schedulers.blocking import BlockingScheduler
4+
5+
from caller import search
6+
7+
8+
sched = BlockingScheduler()
9+
10+
# Schedule job_function to be called every two hours
11+
sched.add_job(search, 'interval',hours=1) # for testing instead add hours =1
12+
13+
sched.start()

BlackJack_game/blackjack.py

+26-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
1+
master
2+
# BLACK JACK - CASINO A GAME OF FORTUNE!!!
3+
import time
4+
15
# BLACK JACK - CASINO
6+
# PYTHON CODE BASE
7+
28

9+
master
310
import random
411

512
deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11] * 4
613

714
random.shuffle(deck)
815

9-
print(
10-
" ********************************************************** ")
11-
print(
12-
" Welcome to the game Casino - BLACK JACK ! ")
13-
print(
14-
" ********************************************************** ")
1516

17+
print('********************************************************** \n Welcome to the game Casino - BLACK JACK ! \n**********************************************************')
18+
time.sleep(2)
19+
print('So Finally You Are Here To Accept Your Fate')
20+
time.sleep(2)
21+
print('I Mean Your Fortune')
22+
time.sleep(2)
23+
print('Lets Check How Lucky You Are Wish You All The Best')
24+
time.sleep(2)
25+
print('Loading---')
26+
time.sleep(2)
27+
28+
print('Still Loading---')
29+
time.sleep(2)
30+
print('So You Are Still Here Not Gone I Gave You Chance But No Problem May Be You Trust Your Fortune A Lot \n Lets Begin Then')
31+
time.sleep(2)
1632
d_cards = [] # Initialising dealer's cards
1733
p_cards = [] # Initialising player's cards
18-
34+
time.sleep(2)
1935
while len(d_cards) != 2:
2036
random.shuffle(deck)
2137
d_cards.append(deck.pop())
@@ -46,7 +62,7 @@
4662
print("*****************The match is tie !!*************************")
4763
exit()
4864

49-
65+
# function to show the dealer's choice
5066
def dealer_choice():
5167
if sum(d_cards) < 17:
5268
while sum(d_cards) < 17:
@@ -85,7 +101,8 @@ def dealer_choice():
85101

86102

87103
while sum(p_cards) < 21:
88-
104+
105+
#to continue the game again and again !!
89106
k = input('Want to hit or stay?\n Press 1 for hit and 0 for stay ')
90107
if k == 1:
91108
random.shuffle(deck)

BruteForce.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ def testFunction(password):
8282
password, attempts = findPassword(chars, testFunction, show=1000, format_=" Trying %s")
8383

8484
t = datetime.timedelta(seconds=int(time.process_time() - t))
85-
input("\n\n Password found: {}\n Attempts: {}\n Time: {}\n".format(password, attempts, t))
85+
input(f"\n\n Password found: {password}\n Attempts: {attempts}\n Time: {t}\n")

CRC/crc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def crc_check(data, div):
2727

2828
while 1 > 0:
2929
print("Enter data: ")
30-
data = input()
30+
data = input() #can use it like int(input())
3131
print("Enter divisor")
32-
div = input()
32+
div = input() #can use it like int(input())
3333
original_data = data
3434
data = data + ("0" * (len(div) - 1))
3535
crc = crc_check(data, div)

Counting-sort.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#python program for counting sort (updated)
22
n=int(input("please give the number of elements\n"))
3-
tlist = list()
4-
print("okey now plase give the elemets")
5-
for i in range(n):
6-
tlist.append(int(input("\n")))
3+
print("okey now plase enter n numbers seperated by spaces")
4+
tlist=list(map(int,input().split()))
75
k = max(tlist)
86
n = len(tlist)
97

Decimal_To_Binary.py

+16-36
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,20 @@
66
77
THis program accepts fractional values, the accuracy can be set below:
88
'''
9-
decimal_accuracy = 7
109

11-
12-
def dtbconverter(num): # Function inputs a float value and returns a list as output
13-
# Reasoning for list instead of integer: to avoid integer overflow error.
14-
15-
whole = [] # The part before decimal point
16-
fractional = ['.'] # The part after decimal point
17-
18-
decimal = round(num % 1, decimal_accuracy) # Extract fractional number part of decimal
19-
w_num = int(num) # Extract whole number part of decimal.
20-
21-
i = 0 # Some fractional decimal numbers have infinite binary values, so we limit this loop below.
22-
23-
# Loop to find binary of decimal part
24-
while (decimal != 1 and i < decimal_accuracy):
25-
decimal = decimal * 2
26-
fractional.append(int(decimal // 1))
27-
decimal = round(decimal % 1, decimal_accuracy)
28-
if (decimal == 0): break # Removes trailing zeros.
29-
i = i + 1
30-
31-
# Loop to find binary of whole number part.
32-
while (w_num != 0):
33-
whole.append(w_num % 2)
34-
w_num = w_num // 2
35-
whole.reverse()
36-
37-
return whole + fractional ### End of dtbconverter() - 16 lines
38-
39-
40-
# Test lines.
41-
# Converts user input to float which is a string initially
42-
number = float(input("Enter Any base-10 Number: "))
43-
# The * operator unpacks the list returned by dtbconverter(number)
44-
print("The Binary Equivalant: ", *dtbconverter(number))
45-
print("Done")
10+
# Function to convert decimal number
11+
# to binary using recursion
12+
def DecimalToBinary(num):
13+
14+
if num > 1:
15+
DecimalToBinary(num // 2)
16+
print(num % 2, end = '')
17+
18+
# Driver Code
19+
if __name__ == '__main__':
20+
21+
# decimal value
22+
dec_val = 24
23+
24+
# Calling function
25+
DecimalToBinary(dec_val)

Digital Clock/digital_clock.py

+45-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,53 @@
1+
master
2+
# importing whole module
13
# use Tkinter to show a digital clock
4+
# using python code base
5+
26
import time
7+
#because we need digital clock , so we are importing the time library.
8+
master
39
from tkinter import *
10+
from tkinter.ttk import *
11+
12+
# importing strftime function to
13+
# retrieve system's time
14+
from time import strftime
15+
16+
# creating tkinter window
17+
root = Tk()
18+
root.title('Clock')
19+
20+
master
21+
22+
# This function is used to
23+
# display time on the label
24+
def time():
25+
string = strftime('%H:%M:%S %p')
26+
lbl.config(text = string)
27+
lbl.after(1000, time)
428

5-
root = Tk()
29+
# Styling the label widget so that clock
30+
# will look more attractive
31+
lbl = Label(root, font = ('calibri', 40, 'bold', 'italic'),
32+
background = 'Black',
33+
foreground = 'Yellow')
634

7-
root.title("Digital Clock")
8-
root.geometry("250x100+0+0")
9-
root.resizable(0,0)
35+
# Placing clock at the centre
36+
# of the tkinter window
37+
lbl.pack(anchor = 'center')
38+
time()
1039

11-
label = Label(root, font=("Arial", 30, 'bold'), bg="blue", fg="powder blue", bd =30)
40+
mainloop()
41+
=======
42+
label = Label(root, font=("Arial", 30, 'bold'), bg="black", fg="white", bd =30)
1243
label.grid(row =0, column=1)
1344

45+
46+
47+
#function to declare the tkniter clock
1448
def dig_clock():
1549

16-
text_input = time.strftime("%H:%M:%S") # get the current local time from the PC
50+
text_input = time.strftime("%H : %M : %S") # get the current local time from the PC
1751

1852
label.config(text=text_input)
1953

@@ -23,6 +57,10 @@ def dig_clock():
2357

2458
label.after(200, dig_clock)
2559

60+
61+
62+
# calling the function
2663
dig_clock()
2764

28-
root.mainloop()
65+
root.mainloop()
66+
master

Email-Automation.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import smtplib
2+
from email.mime.multipart import MIMEMultipart
3+
from email.mime.text import MIMEText
4+
5+
6+
7+
8+
message=MIMEMultipart()
9+
message['From']=fro_add
10+
message['To']=",".join(to_add)
11+
message['subject']="Testinf mail"
12+
13+
body='Hai this is dilip ,How are you'
14+
15+
message.attach(MIMEText(body,'plain'))
16+
17+
email=" "
18+
password=" "
19+
20+
mail=smtplib.SMTP('smtp.gmail.com',587)
21+
mail.ehlo()
22+
mail.starttls()
23+
mail.login(email,password)
24+
text=message.as_string()
25+
mail.sendmail(fro_add,to_add,text)
26+
mail.quit()

0 commit comments

Comments
 (0)