-



Download 9,79 Mb.
Pdf ko'rish
bet31/64
Sana16.01.2022
Hajmi9,79 Mb.
#372467
1   ...   27   28   29   30   31   32   33   34   ...   64
Bog'liq
[Nichola Lacey] Python by Example Learning to Pro(1)

print(fruit_tuple[2]) 
Displays item 2 from 
“fruit_tuple”, in this case 
“strawberry”. 
 
names_list = [“John”,“Tim”,“Sam”] 
Creates a list of the names and stores them in the 
variable “names_list”. The square brackets define 
this group of data as a list and therefore the contents 
can be altered while the program is running.
 
names_list.append(input(“Add a name: “)) 
Asks the user to enter a name and will add that to the end of 
“names_list”.
 
del names_list[1] 
Deletes item 1 from 
“names_list”. Remember 
it starts counting from 0 
and not 1. In this case it 
will delete “Tim” from the 
list.
 
print(sorted(names_list)) 
Displays names_list in alphabetical 
order but does not change the order of 
the original list, which is still saved in 
the original order. This does not work 
if the list is storing data of different 
types, such as strings and numeric 
data in the same list.
 

Download 9,79 Mb.

Do'stlaringiz bilan baham:
1   ...   27   28   29   30   31   32   33   34   ...   64




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