0% found this document useful (0 votes)
6 views

Main Py

main

Uploaded by

naitiktiwari09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Main Py

main

Uploaded by

naitiktiwari09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

#

while True:
#MAIN MENU DISPLAY
print('***--------Main Menu--------***')
print("Choose Your Data Type")
print("1.) List ")
print("2.) String")
print("3.) Dictionary ")
M_I = int(input("Enter the no. beside your choice (1,2,3): "))

#LIST
if M_I == 1 :

print("*************************")
M_L =[]
No_l = int(input("how many elements you want in the list: "))
print("Enter your list elements : ")
for a_l in range (0,No_M_List):
b_l = input()
M_L.append(b_l)
print("Your List = ",M_L)

#List Menu
print("***List Menu***")
print("Choose Your Modifications ;) : ")
print("1.) operators ")
print("2.) function")
print("3.) Wanna Remove elements ;) :")
print("4.) Membership ")
print("5.) Wanna put it on Display ")

L_i = int(input("Enter the no. beside your choice (1,2,3,4,5): "))

#Operators
if ch1==1:
ch11=str(input("Enter the operant (+,*) : "))
if ch11=="+":
n=int(input("how many elements you want in the list to be added :
"))
print("Enter the elments row wise")
ligma=[]
for j in range (0,n):
niggers=input()
ligma.append(niggers)
print("New list : ",M_L+ligma)
if ch11=="*":
n=int(input("how many times you want to multiply list : "))
print("New list : ",M_L*n)

#Function
elif ch1==2:
print("Choose Your Modifications ;) : ")
print("1.) Extend ")
print("2.) Append")
print("3.) Insert :")
print("4.) Lenth of the list ")
print("5.) Index ")
print("6.) count :")
print("7.) reverse ")
print("8.) sort ")
ch12=int(input("Enter the no. beside your choice (1,2,3,4,5,6,7,8):
"))
if ch12==1:
no=int(input("how many elements you want in the list to be extended
: "))
print("Enter the elments row wise")
ligmamales=[]
for crazydiamond in range (0,no):
nigger=input()
ligmamales.append(nigger)
M_L.extend(ligmamales)
print("List created ",ligmamales)
print(M_L)
if ch12==2:
no=int(input("how many elements you want in the list to be append :
"))
print("Enter the elments row wise")
for crazydiamond in range (0,no):
nigger=input()
M_L.append(nigger)
print(M_L)
elif ch12==3:
index=int(input("Enter the position of the element for insertion ;)
(start from 0)"))
entah=input("Enter the element to enter ")
M_L.insert(index,entah)
print(M_L)
elif ch12==4:
print(len(M_L))
elif ch12==5:
search=str(input("Enter the element to be searched for index "))
if search in M_L :
print(M_L.index(search))
else:
print("Not found")
elif ch12==6:
cunt=str(input("Enter the element to be searched for counting "))
print(M_L.count(cunt))
elif ch12==7:
M_L.reverse()
print("new list is ",M_L)
elif ch12==8:
M_L.sort()
print("new list is ",M_L)

#Remove elements
elif ch1==3:
print("Choose Your Modifications ;) : ")
print("1.) del ")
print("2.) skrr pop pop pop")
print("3.) slice n dice :")
print("4.) clear ")
ch13=int(input("Enter your choice (1,2,3,4):"))
if ch13==1:
dekete=str(input("Enter what you want to delete:"))
M_L.remove(dekete)
print("New list is now ", l)
elif ch13==2:
ind=int(input("Enter the index to pop :"))
M_L.pop(ind)
print(M_L)
elif ch13==3:
skibidi=int(input("Enter the index to start slicing from :"))
toilet=int(input("Enter the index to end slicing from (Must be
greater than skibidi):"))
M_L=l[skibidi:toilet]
print(M_L)
elif ch13==4:
M_L.clear()
print("List cleared",M_L)

#Membership
elif ch1==4:
member=str(input("Enter the membership operator you want to work with
in or not in (choose from 1 or 2 )"))
if member=="in" or member=="1":
check=str(input("Enter the element you want to check :"))
if check in M_L :
print("The element is inside the list ")
else:
print("The element is not inside the list")
else:
check=str(input("Enter the element you want to check :"))
if check not in M_L:
print("The element is not inside the list ")
else:
print("The element is not inside the list")

#Display
elif ch1==5:
print(M_L)

l_con = (input('Do you want to continue in list: '))


if l_con == 'no' :
break

#STRING
elif M_I == 2 :

print("*************************")
s=str(input("Enter you string : "))
print("Your string = ",s)

while True :
#String Menu
print("***Main Menu***")
print("Choose Your Modifications ;) : ")
print("1.) Capitalise all words")
print("2.) Search a word")
print("3.) check the digits in the string;) :")
print("4.) Convert Upper to lower ")
print("5.) Replace the the occurance of a substring")
print("6.) Count the total words in range ")

ch2=int(input("Enter the no. beside your choice (1,2,3,4,5): "))


if ch2==1:
nigga=s.title()
print(nigga)
elif ch2==2:
sea=str(input("Enter this thingy mabob to search like wassup"))
if sea in s:
k=s.find(sea)
print("the search element is after ",k,"th index")
else:
print("Not found")
elif ch2==3:
for starplatinum in range (0,len(s)):
i=0
if s[starplatinum] in "0123456789":
i+=s[starplatinum]
print(s[starplatinum])
if i==0:
print("No numbah in here")
elif ch2==4:
ns=""
for stonefree in range (0,len(s)):
if s[stonefree].isupper()==True:
ns+=s[stonefree].lower()
if s[stonefree].islower()==True:
ns+=s[stonefree].upper()
s=ns
print(s)
elif ch2==5:
re=str(input("What do you want to replace :"))
er=str(input("With What : "))
s=s.replace(re,er)
print(s)
elif ch2==6:
print(len(s.split()))

s_con = (input('Do you want to continue in string: '))


if s_con == 'no' :
break

#DICTIONARY
elif M_I == 3 :
print("*************************")
No_D = int(input("How man items you want to have in the dictionary :"))
M_D = {}
for D in range (0,No_D):
Key = input("Enter key :")
Value = input("Enter value :")
M_D[Key] = Value
print(M_D)

while True :
#Dictioanry Menu
print("***Dictioanry Menu***")
print("Choose Your Modifications ;) : ")
print("1.) Delete key")
print("2.) display only keys")
print("3.) display only values:")
print("4.) Modify the value of keys as per user : ")
D_i_1 = int(input("Enter your choice (1,2,3,4): "))

#Delete item
if D_i_1 == 1 :
del_D = input("Enter key to be deleted :")
if del_D not in M_D :
print("key don't exist")

else:
del M_D[del_D]
print(M_D)

#Display only keys


elif D_i_1 ==2:
print(list(M_D.keys()))

#display only values


elif D_i_1 ==3:
print(list(M_D.values()))

#Modify the value of keys as per user


elif D_i_1 ==4:
replacment=input("Enter key :")
rep=input("Enter the new value :")
M_D[replacment]=rep
print(M_D)

d_con = (input('Do you want to continue in dictionary : '))


if d_con == 'no' :
break

#Continue
Sub_Input = (input('Do you want to continue: '))
if Sub_Input == 'no':
break

You might also like