Python Print Function, Introduction, String Formatting, Format Method

Veröffentlicht am: 01 Januar 1970
auf dem Kanal: GSS
25
0

Website: http://genioussoftwareservices.co.in


#Python Introduction


Python is case-sensitive language
Python supports OOP's concept
Python used in Web development, Machine Learning,
Data Analytics, Artificial Intelligence etc..
Python used by the companies like Google, Facebook,
Instagram, Netflix etc...
Python is an interpreted language




print function


print("Hello World!")
print('Hello World')
print(10)
print(20.33)
print(type(10))


x = 10
y = 'hello'
z = x + y
print(z)


x = """ Python
Supports
OOP's
"""
print(x)


x = "Hello"
print(len(x))


#Slicing
#Array index starts from 0, 1, 2.... from start


#Indexing
x = "Hello"
print(x[4])


#Negative Indexing
#Negative Indexing starts from -1, -2, .... from end
x = "Hello"
print(x[-5])


#Slicing
#In slicing, we provide the range of indexes
x = "Hello"
print(x[0:4])
print(x[2:])
print(x[:4])
print(x[:])


x = "Hello"
print(x[-5:-2])
print(x[:-1])
print(x[-5:])


Strip Methods
#Remove whitespaces from the beginning or end


x = " Hello "
print(x.strip())


x = " Hello"
print(x.lstrip())


x = "Hello "
print(x.rstrip())


x = "hello"
print(x.upper())


x = "HELLO"
print(x.lower())


x = " India is great"
print(x.replace("great", "popular"))


x = " India is great"
print(x.split("is"))


x = "Helllllo"
print(x.count('o'))


x = "Hello"
print(x.find('e'))


x = "Hello"
print(x.index('H'))


x = "Ind"
y = "ia"
z = x + y
print(z)


x = 'what\'s up'
print(x)


x = 'what\n up'
print(x)


x = 'what\t up'
print(x)




x = 10
y = "KM"
z = x + y
print(z)


#String Formating
curly brackets {}
format() method


x = 10
y = "{} KM"
print(y.format(x))


x = 10
z = 20
y = "{1} KM"
print(y.format(z,x))


Python List
store multpile items in a single variable
Array can not store different data types
List can store different data types
Lists are mutable means changeable
Duplicate values are allowed
Lists are ordered
Insertion order is preserved
Lists are represented by square brackets [] and
values separated by comma.


Create a List


mylist = [10, "delhi", 20.33, True, 10, -50]
print(mylist)
print(type(mylist))


Auf dieser Seite können Sie das Online-Video Python Print Function, Introduction, String Formatting, Format Method mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer GSS 01 Januar 1970 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 25 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!