-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_Lesson_5.py
More file actions
42 lines (31 loc) · 1.57 KB
/
Copy pathPython_Lesson_5.py
File metadata and controls
42 lines (31 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#format()
# s = input('What is your name: ')
# print('Hello {}'.format(s))
# print('{:.5}'.format(s)) # truncate long string -- yani nechta belgini chiqarish
# print('{} {}'.format('one', 'two'))
# soz = 'I love programming with python'
# print(len(soz.split()))
# class Data(object):
# def __str__(self):
# return 'str'
# def __repr__(self):
# return 'repr'
# print('{0!s} {0!r}'.format(Data()))
# print('{:10}{}'.format('test','ss')) # testdan keyin 10 ta qator tashlaydi
# print('{:>10} {}'.format('test','ss')) # testdan oldin 10 ta qator tashlaydi
# print('{:^10}'.format('test')) # testni 10 beligini ichiga joylashtirib beradi
# s = input('Kiriting: ')
# print(s.capitalize()) # bosh harfini katta qilib beradi
#print(s.upper()) #hamma harflarini katta qilib beradi
# print(s.casefold()) # hamma harflarni kichik qilib beradi
# print(s.count('i',)) # matnda nechta so'z yoki harfligini sanab beradi
# print(len(s)) # nechta belgi borligini sonini chiqaradi
# print(s.split()) # so'zlarni alohida alohid hisoblaydi probellar orqali list qaytaradi
# a = ' banana....fef '
# print(a.strip()) # boshi va oxiridagi ortiqcha probellarni olib tashlaydi
# # so'zni teskarisiga chiqaruvchi dastur
# s = input('So\'z kiriting: ')
# print(s[::-1].swapcase())
# Masala
# s = input("So'z kiriting: ")
# print(' '.join(s.split()[::-1])) # join funksiyasi list yoki tupledagi malumotni qoshib stringda qaytaradi