Skip to content

Instantly share code, notes, and snippets.

View Deep18-03's full-sized avatar
🏠
Working from home

Deep18-03

🏠
Working from home
View GitHub Profile
#hotem managemnet system
client_list={1:"harry",2:"carry",3:"danny"}
lock_list={1:"exercise",2:"food"}
import datetime
def gettime():
return datetime.datetime.now()
def lock(op):
for key,value in lock_list.items():
#factorial
def factorial(n):
"""
5*4*3*2*1
"""
if n==1:
return 1
else:
return n*factorial(n-1)
number=int(input("enter the number"))
#fibonaci
def fibonaci(n):
if n==1:
return 0
elif n==2:
return 1
else:
return fibonaci(n-1)+fibonaci(n-2)
#snake water gun
import random
user_option={1:'snake',2:'water',3:'gun'}
option=['water','snake','gun',]
choice=random.choice(option)
def compare(user_ch,comp_ch):
"""This function compare the input of user and computer generated input and declare the winner """
# #lambda function
minus=lambda x,y:x-y
print(minus(3,4))
print("\n")
a=[[1,14],[5,6],[2,18]]
a.sort(key=lambda x:x[1])
print(a)
def function(*args,**kwargs):
for i in args:
print(i)
for k,v in kwargs.items():
print(k,v)
har=["harry","carry","marry"]
kw={1:"deep",2:"dev"}
function(*har,**kw)
import time
# intial=time.time()
# for i in range(15):
# print("hello hey")
# time.sleep(2)
# print("time taken by this function\n"+str(time.time()-intial)+"seconds")
localtime=time.asctime(time.localtime(time.time()))
print(localtime)
l1=["cod","pung","counterstrike","minecraft"]
import time
# i=1
# for item in l1:
# if i%2 is not 0:
# print("jarvis select nuy this "+item)
localtime=time.asctime(time.localtime(time.time()))
#use enumerate
for index,items in enumerate(l1):
lst=['john cena','randy orton','jindawr mahal','roman']
a="add ".join(lst)
print(a)
#map,filter,reduce
#lets take map -we can provide any function to list using map
lst=["2","3","4","5","6","7","8"]
num=list(map(int,lst))
print(num)
num1=list(map(lambda x:x*x,num))