Learning Python: The Ultimate Guide for Beginners to Coding with Python with Useful Tools



Download 2,02 Mb.
Pdf ko'rish
bet24/126
Sana01.01.2022
Hajmi2,02 Mb.
#285662
1   ...   20   21   22   23   24   25   26   27   ...   126
Bog'liq
Learning Python The Ultimate Guide for Beginners to Coding with

Consider the code below
state  =  'United  Nation!'      #Assign  the  variable  “state”  to  a  string  ‘New
York’
print state          # Prints the complete string
print state[0]       # Prints the first character of the string
print state[0:4]     # Prints characters starting from 1st to 4th
print state[3:]      # Prints string starting from 4th character
print state * 3      # Prints string three times
print state + " United State" # Prints concatenated string
The output will be –
United Nation!
U
United
Nations!
United Nation! United Nation!
United Nation! United State
Comments


If  you  observe  in  the  program  above,  we  use  the  symbol  #  to  begin  a
statement  after  declaring  a  variable.  Nevertheless,  it  shouldn’t  be  used
within  a  string  literal.  The  Python  interpreter  ignores  comments  because
they  are  not  part  of  the  program  but  provide  an  explanatory  note  for  the
programmer. Let us look at this example below:
#Learning about Comments in Python
print “Learning Python Language isn’t complicated.”
#Another comment to make things better
When you run this program, the output will be:
Learning Python Language isn’t complicated.

Download 2,02 Mb.

Do'stlaringiz bilan baham:
1   ...   20   21   22   23   24   25   26   27   ...   126




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