Python Print Function, Introduction, String Formatting, Format Method

Publicado el: 01 enero 1970
en el canal de: 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))


En esta página del sitio puede ver el video en línea Python Print Function, Introduction, String Formatting, Format Method de Duración hora minuto segunda en buena calidad , que subió el usuario GSS 01 enero 1970, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 25 veces y le gustó 0 a los espectadores. Disfruta viendo!