python

mail@pastecode.io avatar
unknown
java
a month ago
1.2 kB
3
Indexable
Never
str="  avanthi engineering college"
print(str)
print(type(str))
print(str.capitalize())
print(str.title())
print(str.upper())
print(str.lower())
print(str.center(200))
str1="AVANTHI ENGINEERING COLLEGE"
print(str1.casefold())
print(str.count("e"))
print(str.find("e"))
print(str.encode())
print(str.endswith("e"))
a="#".join(str)
print(a)
str.replace(" ","#")
str.strip()
str.title()





d={"name":"avanthi","location":"hyderabad"}
print(d)
print(type(d))
d.get("name")
a=d.items()
print(a)
b=d.keys()
print(b)
d.pop("location")
d.update({"branch":"csd"})
print(d)
x=d.values()
print(x)



    list=['mango','apple','watermelon','banana']
    print(list)
    print(type(list))
    list.append('orange')
    print(list)
    list.remove('watermelon')
    print(list)
    list.pop(0)
    print(list)
    list.insert(1,'orange')
    print(list)
    print(list.count('orange'))
    print(list.index('apple'))
    list.pop(3)
    print(list)
    list.remove('orange')
    print(list)
    list1=['mango','apple','watermelon','banana']
    list1.reverse()
    print(list1)
    list1.sort()
    print(list)
    list.extend(list1)
    print(list)






Leave a Comment