#Basic Data Types
#number
# Python program to
# demonstrate numeric value
'''a = 5
print("Type of a: ", type(a))
b = 5.0
print("\nType of b: ", type(b))
c = 2 + 4j
print("\nType of c: ", type(c))'''
'''####################
# Python Program for
# Creation of String
# Creating a String
# with single Quotes
String1 = 'Welcome to World'
print("String with the use of Single Quotes: ")
print(String1)
# Creating a String
# with double Quotes
String1 = "I'm Ravi"
print("\nString with the use of Double Quotes: ")
print(String1)
print(type(String1))
############################
# Python Program to Access
# characters of String
String1 = "Summercamp"
print("Initial String: ")
print(String1)
# Printing First character
print("\nFirst character of String is: ")
print(String1[0])
# Printing Last character
print("\nLast character of String is: ")
print(String1[-1])
########################
str1 = 'hello RaviUyyala' #string str1
str2 = ' how are you' #string str2
print (str1[0:2]) #printing first two character using slice operator
print (str1[6]) #printing 4th character of the string
print (str1*2) #printing the string twice
print (str1 + str2) #printing the concatenation of str1 and str2'''
#################################
#String Methods
txt = "python is fun!"
x = txt.capitalize()
print (x)
###########
txt = "Hello, And Welcome To My World!"
x = txt.casefold()
print(x)
###############
txt = "banana"
x = txt.center(20)
print(x)
###########
txt = "I love apples, apple are my favorite fruit"
x = txt.count("apple")
print(x)
##############
txt = "Hello, welcome to my world."
x = txt.endswith(".")
print(x)
###############
txt = "H\te\tl\tl\to"
x = txt.expandtabs(2)
print(x)
#################
txt = "Hello, welcome to my world."
x = txt.find("welcome")
print(x)
##############
txt = "For only {price:.2f} dollars!"
print(txt.format(price = 49))
#############
txt = "Hello, welcome to my world."
x = txt.index("welcome")
print(x)
################
txt = "Company12"
x = txt.isalnum()
print(x)
#########
txt = "CompanyX"
x = txt.isalpha()
print(x)
#################
txt = "\ratu"
x = txt.isdecimal()
print(x)
###############
txt = "hello world!"
x = txt.islower()
print(x)
#################
txt = "THIS IS NOW!"
x = txt.isupper()
print(x)
################
txt = "Hello my FRIENDS"
x = txt.lower()
print(x)
#############
txt = "Hello my FRIENDS"
x = txt.lower()
print(x)
####################
txt = " banana "
x = txt.lstrip()
print("of all fruits", x, "is my favorite")
##############
txt = "I like bananas"
x = txt.replace("bananas", "apples")
print(x)
###################
txt = " banana "
x = txt.rstrip()
print("of all fruits", x, "is my favorite")
##################
txt = " banana "
x = txt.strip()
print("of all fruits", x, "is my favorite")
##################
txt = "Hello My Name Is PETER"
x = txt.swapcase()
print(x)
################
txt = "Welcome to my world"
x = txt.title()
print(x)
###################
txt = "Hello my friends"
x = txt.upper()
print(x)
#####################
#List
# Python program to demonstrate
# Creation of List
# Creating a List
List = []
print("Initial blank List: ")
print(List)
# Creating a List with
# the use of a String
List = ['GFG']
print("\nList with the use of String: ")
print(List)
# Creating a List with
# the use of multiple values
List = [1,2,3,"Ravi",5,6,7]
print("\nList containing multiple values: ")
print(List[0])
print(List[2])
# Creating a Multi-Dimensional List
# (By Nesting a list inside a List)
List = [['Ravi', 'For'], ['CBIT']]
print("\nMulti-Dimensional List: ")
print(List)
################
# Python program to demonstrate
# accessing of element from list
# Creating a List with
# the use of multiple values
List = ["Ravi", "For", "List"]
# accessing a element from the
# list using index number
print("Accessing element from the list")
print(List[0])
print(List[2])
# accessing a element using
# negative indexing
print("Accessing element using negative indexing")
# print the last element of list
print(List[-1])
# print the third last element of list
print(List[-3])
#############
thislist = ["apple", "banana", "cherry"]
thislist[1] = "blackcurrant"
print(thislist)
###########
thislist = ["apple", "banana", "cherry", "orange", "kiwi", "mango"]
thislist[1:3] = ["blackcurrant", "watermelon"]
print(thislist)
##################
thislist = ["apple", "banana", "cherry"]
thislist[1:2] = ["blackcurrant", "watermelon"]
print(thislist)
##############
thislist = ["apple", "banana", "cherry"]
thislist[1:3] = ["watermelon"]
print(thislist)
###############
thislist = ["apple", "banana", "cherry"]
thislist.insert(2, "watermelon")
print(thislist)
##############
thislist = ["apple", "banana", "cherry"]
thislist.append("orange")
print(thislist)
#############
thislist = ["apple", "banana", "cherry"]
thislist.insert(1, "orange")
print(thislist)
################
thislist = ["apple", "banana", "cherry"]
tropical = ["mango", "pineapple", "papaya"]
thislist.extend(tropical)
print(thislist)
##################
thislist = ["apple", "banana", "cherry"]
thistuple = ("kiwi", "orange")
thislist.extend(thistuple)
print(thislist)
################
thislist = ["apple", "banana", "cherry"]
thislist.remove("banana")
print(thislist)
################
thislist = ["apple", "banana", "cherry"]
thislist.pop(1)
print(thislist)
#################
thislist = ["apple", "banana", "cherry"]
thislist.pop()
print(thislist)
##################
thislist = ["apple", "banana", "cherry"]
del thislist[0]
print(thislist)
###############
thislist = ["apple", "banana", "cherry"]
del thislist
##############
thislist = ["apple", "banana", "cherry"]
thislist.clear()
print(thislist)
#################
thislist = ["apple", "banana", "cherry"]
for x in thislist:
print(x)
################
fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
newlist = []
for x in fruits:
if "a" in x:
newlist.append(x)
print(newlist)
###############
thislist = ["orange", "mango", "kiwi", "pineapple", "banana"]
thislist.sort()
print(thislist)
##############
thislist = [100, 50, 65, 82, 23]
thislist.sort()
print(thislist)
#############
thislist = ["orange", "mango", "kiwi", "pineapple", "banana"]
thislist.sort(reverse = True)
print(thislist)
###########
thislist = [100, 50, 65, 82, 23]
thislist.sort(reverse = True)
print(thislist)
###################
thislist = ["apple", "banana", "cherry"]
mylist = thislist.copy()
print(mylist)
##################
thislist = ["apple", "banana", "cherry"]
mylist = list(thislist)
print(mylist)
#################
list1 = ["a", "b", "c"]
list2 = [1, 2, 3]
list3 = list1 + list2
print(list3)
##############
list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]
for x in list2:
list1.append(x)
print(list1)
#################
list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]
list1.extend(list2)
print(list1)
###################
fruits = ['apple', 'banana', 'cherry', 'orange']
fruits.clear()
#################
fruits = ['apple', 'banana', 'cherry', 'orange']
x = fruits.copy()
###################
fruits = ['apple', 'banana', 'cherry']
x = fruits.index("cherry")
#####################
fruits = ['apple', 'banana', 'cherry']
fruits.pop(1)
###############
fruits = ['apple', 'banana', 'cherry']
fruits.remove("banana")
#################
fruits = ['apple', 'banana', 'cherry']
x = fruits.count("cherry")
print(x)
##################Tuple
# Python program to demonstrate
# creation of Set
# Creating an empty tuple
Tuple1 = ()
print("Initial empty Tuple: ")
print (Tuple1)
# Creating a Tuple with
# the use of Strings
Tuple1 = ('Ravi', 'For')
print("\nTuple with the use of String: ")
print(Tuple1)
# Creating a Tuple with
# the use of list
list1 = [1, 2, 4, 5, 6]
print("\nTuple using List: ")
print(tuple(list1))
# Creating a Tuple with the
# use of built-in function
Tuple1 = tuple('Ravi')
print("\nTuple with the use of function: ")
print(Tuple1)
# Creating a Tuple
# with nested tuples
Tuple1 = (0, 1, 2, 3)
Tuple2 = ('python', 'Ravi')
Tuple3 = (Tuple1, Tuple2)
print("\nTuple with nested tuples: ")
print(Tuple3)
##################
# Python program to
# demonstrate accessing tuple
tuple1 = tuple([1, 2, 3, 4, 5])
# Accessing element using indexing
print("First element of tuple")
print(tuple1[0])
# Accessing element from last
# negative indexing
print("\nLast element of tuple")
print(tuple1[-1])
print("\nThird last element of tuple")
print(tuple1[-3])
######################
thistuple = ("apple", "banana", "cherry")
print(thistuple)
###########
thistuple = ("apple", "banana", "cherry", "apple", "cherry")
print(thistuple)
###########
thistuple = ("apple", "banana", "cherry")
print(len(thistuple))
###################
tuple1 = ("apple", "banana", "cherry")
tuple2 = (1, 5, 7, 9, 3)
tuple3 = (True, False, False)
print(tuple1)
print(tuple2)
print(tuple3)
####################
tuple1 = ("abc", 34, True, 40, "male")
#################
thistuple = tuple(("apple", "banana", "cherry")) # note the double round-brackets
print(tuple1)
print(thistuple)
#############
thistuple = ("apple", "banana", "cherry")
print(thistuple[1])
############
thistuple = ("apple", "banana", "cherry")
print(thistuple[-1])
###########
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:5])
##########
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[:4])
###############
thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[2:])
##############
thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = thistuple.count(5)
print(x)
###############
thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)
x = thistuple.index(8)
print(x)
#####################
thistuple = ("apple", "banana", "cherry")
y = ("orange",)
thistuple += y
print(thistuple)
###############
thistuple = ("apple", "banana", "cherry")
for x in thistuple:
print(x)
#############
tuple1 = ("a", "b" , "c")
tuple2 = (1, 2, 3)
tuple3 = tuple1 + tuple2
print(tuple3)
#################
fruits = ("apple", "banana", "cherry")
mytuple = fruits * 2
print(mytuple)
#############
thisset = {"apple", "banana", "cherry"}
print(thisset)
################
thisset = {"apple", "banana", "cherry", "apple"}
print(thisset)
###############
fruits = {"apple", "banana", "cherry"}
fruits.add("orange")
print(fruits)
'##################
fruits = {"apple", "banana", "cherry"}
fruits.clear()
print(fruits)
#################
ruits = {"apple", "banana", "cherry"}
x = fruits.copy()
print(x)
############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.difference(y)
print(z)
###############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.difference_update(y)
print(x)
###############
fruits = {"apple", "banana", "cherry"}
fruits.discard("banana")
print(fruits)
###############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.intersection(y)
print(z)
###############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.intersection_update(y)
print(x)
#############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "facebook"}
z = x.isdisjoint(y)
print(z)
#################
x = {"a", "b", "c"}
y = {"f", "e", "d", "c", "b", "a"}
z = x.issubset(y)
print(z)
#############
x = {"f", "e", "d", "c", "b", "a"}
y = {"a", "b", "c"}
z = x.issuperset(y)
print(z)
##################
fruits = {"apple", "banana", "cherry"}
fruits.pop()
print(fruits)
###################
fruits = {"apple", "banana", "cherry"}
fruits.remove("banana")
print(fruits)
#################
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.symmetric_difference(y)
print(z)
#############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.symmetric_difference_update(y)
print(x)
###############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.union(y)
print(z)
###############
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.update(y)
print(x)
##################
#Dictionary
# Creating an empty Dictionary
Dict = {}
print("Empty Dictionary: ")
print(Dict)
# Creating a Dictionary
# with Integer Keys
Dict = {1: 'Ravi', 2: 'Kumar', 3: 'CBIT'}
print("\nDictionary with the use of Integer Keys: ")
print(Dict)
# Creating a Dictionary
# with Mixed keys
Dict = {'Name': 'Ravi', 1: [1, 2, 3, 4]}
print("\nDictionary with the use of Mixed Keys: ")
print(Dict)
# Creating a Dictionary
# with dict() method
Dict = dict({1: 'Ravci', 2: 'For', 3:'CBIT'})
print("\nDictionary with the use of dict(): ")
print(Dict)
# Creating a Dictionary
# with each item as a Pair
Dict = dict([(1, 'Ravi'), (2, 'CBIT')])
print("\nDictionary with each item as a pair: ")
print(Dict)
##################
# Python program to demonstrate
# accessing a element from a Dictionary
# Creating a Dictionary
Dict = {1: 'Ravi', 'name': 'Kumar', 3: 'CBIT'}
# accessing a element using key
print("Accessing a element using key:")
print(Dict['name'])
# accessing a element using get()
# method
print("Accessing a element using get:")
print(Dict.get(3))
#####################
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964,
"year": 2020
}'''