You are on page 1of 5

# -*- coding: utf-8 -*-

"""
Spyder Editor

This is a temporary script file.


"""
a="happy is happy and happy is sad"
print(a[len(a)-1::-1])
a="noida sector sector"
print(len(a))
print(max(a))
print(min(a))

a="the lion and deer"


print(a.capitalize())
print(a.title())

a="the raju is duffer"


print(a.replace("raju","chatur"))

speech="kunal is chamtkar person and his chamtkar are universal and amazing"
print(speech.replace("chamtkar","idiot")

a="abhinash,raju,sanju,teja"
data=a.split(",")
print(type(data))
print(data)

a=" the enter "


n=(a.strip())# remove white space
print(len(a))
print(len(n))

entry=str(input("enter phone :"))


print(entry.isdigit())
print(entry.isalnum())
print(entry.islower())
print(entry.isupper())
print(entry.isalpha())
################################
tuple:immutable most secure one

t=(1,2,3,4,5,6,7,8,9)
print(type(t))

t=(1)
print(type(t))

t=(1,)
print(type(t))

l=[1,2,3,4]
l[1]=10000
print(l)

t=(1,2,3)
t[1]
t[0:]
t[0]=5000#errorr
#TypeError: 'tuple' object does not support item assignment
#count
t=(11,2,3,11,111,4441,2,11)
t.count(11)
#index
t=(11,3,111,4441,2)
t.index(3)

t=(1,2,3,[12,32,45],51)
t[3][0]=5555
print(t)
#######################################
#dictionary
data={}#empty dict
print(type(data))
#d={key:value,key:value,.......}
#set={value,value,value}
#prop of dict:
# key is always unique
data={"a":323,"b":333,"c":339}
print(type(data))

#data[key]=value
#adding elemt
data["d"]=336
print(data)

a={"a":1,"b":56,"a":12}
a.pop("a")
print(a)

#del elemnt
#data.pop("key")
data.pop("b")
print(data)

#access value ffrom key


data["c"]
data[336]#this is not possible

#update
data.update({"e":123,'f':254,"rt":442,"c":10000})
print(data)
# del all data
data.clear()
print(data)
##############################################
operator AO
a=int(input("enter number"))
b=int(input("enter number"))
print(a+b)
print(a-b)
print(a*b)
print(a**b)
print(a//b)#value floor
print(a/b)#value float
print(a%b)
########################################
#condition
a=int(input("enter number"))
b=int(input("enter number"))
print(a==b)
print(a>b)
print(a<b)
print(a!=b)
print(a>=b)
print(a<=b)
##############################
#logical opertor
a=True
b=False
print(a and b)
print(a or b)
print(not a)
######################################
#membership operator: in ,not in
l=[1,2,3,4,5,6,78]
a=int(input("enter number"))
print(a in l)
print(a not in l)
###############################
#identity operator: is and is not
a=[1,2,3,4,5,6]
print(a[0] is 1)
print(a[0] is not 1)
####################################
#if condition:
# print("statment")

a="samosa"
item=str(input("enter choice"))
if( item==a):
print("give me 1 pice")

###IF_ELSE
#if condition:
# print("statment")
#else:
# print("statemnt")
a="samosa"
item=str(input("enter choice :"))
if( item==a):
print("give me 1 pice")
else:
print("KYU DUKAN KHOL K BETHO HO")
###########################################
###IF_ELSE
#if condition:
# print("statment")
#elif condition:
# print("statment")
#else:
# print("statemnt")
item=str(input("enter choice :"))
if( item=="samosa"):
print("give me 1 pice :",item)
elif(item=="jalebi"):
print("give me",item,"1kg")
else:
print("KYU DUKAN KHOL K BETHO HO")
###########################################
le=[]
lp=[]
print(" @@@@@@ WELCOME TO MY SYSTEM @@@@@@@ ")
print(" ")
print(" 1:Register new account 2:Login account 3:del account")
ch=int(input("enter choice"))
if(ch==1):
e=str(input("enter email ID"))
p=str(input("Create password"))
le.append(e.lower())
lp.append(p)
print(" Account Created Sucessfully ")
elif(ch==2):
e=str(input("enter email ID"))
if(e.lower() in le):
ind=le.index(e.lower())
pasw=str(input("enter passwor"))
p=lp[ind]
if(pasw==p):
print("ACCESS GRANTED")
else:
print("INVALID PASSWORD")
else:
print("INVALID EMAIL")
elif(ch==3):
e=str(input("enter email ID"))
if(e.lower() in le):
ind=le.index(e.lower())
pasw=str(input("enter passwor"))
p=lp[ind]
if(pasw==p):
# we are del data with ref of index
le.pop(ind)
lp.pop(ind)
print("Account deleted sucessfully")
else:
print("INVALID PASSWORD")
else:
print("INVALID EMAIL")

##################################
## set

a={1,2,3,41,2,1,2,15,42}
print(type(a))
print(a)
# set is an unorder unique sequence

a={1,2,3,4,5}
b={1,2,3,6,8}
print(a^b)
print(a&b)
print(a|b)
print(a-b)#diff
print(a>b)#subset
print(b>a)#subset

You might also like