About the Tutorial



Download 2,85 Mb.
Pdf ko'rish
bet79/234
Sana28.05.2022
Hajmi2,85 Mb.
#614232
1   ...   75   76   77   78   79   80   81   82   ...   234
Bog'liq
python3 tutorial 060821094426

Mathematical Constants 
The module also defines two mathematical constants- 
Constants 
Description 
pi 
The mathematical constant pi. 

The mathematical constant e. 


Python 3 
99 
Strings are amongst the most popular types in Python. We can create them simply by 
enclosing characters in quotes. Python treats single quotes the same as double quotes. 
Creating strings is as simple as assigning a value to a variable. For example- 
var1 = 'Hello World!' 
var2 = "Python Programming" 
Accessing Values in Strings
 
Python does not support a character type; these are treated as strings of length one, thus 
also considered a substring. 
To access substrings, use the square brackets for slicing along with the index or indices to 
obtain your substring. For example- 
#!/usr/bin/python3 
var1 = 'Hello World!' 
var2 = "Python Programming" 
print ("var1[0]: ", var1[0]) 
print ("var2[1:5]: ", var2[1:5]) 
When the above code is executed, it produces the following result- 
var1[0]: H 
var2[1:5]: ytho 
Updating Strings 
You can "update" an existing string by (re)assigning a variable to another string. The new 
value can be related to its previous value or to a completely different string altogether. 
For example- 
#!/usr/bin/python3 
var1 = 'Hello World!' 
print ("Updated String :- ", var1[:6] + 'Python') 
When the above code is executed, it produces the following result- 
Updated String :- Hello Python 
10.
 
Python 3 – Strings 
 


Python 3 
100 
Escape Characters 
Following table is a list of escape or non-printable characters that can be represented with 
backslash notation. 
An escape character gets interpreted; in a single quoted as well as double quoted strings. 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   75   76   77   78   79   80   81   82   ...   234




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish