-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjour4.py
More file actions
157 lines (97 loc) · 2.68 KB
/
Copy pathjour4.py
File metadata and controls
157 lines (97 loc) · 2.68 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Challenge python Jour 4
# Numero 1
sentence1 = "Thirty" + " " + "Days" + " " + "Of" + " " + "Pyton"
#numero 2
sentence2 = 'Coding' + ' ' + 'For' + ' ' + 'All'
#numero 3
company = "Coding For All"
#numero 4
print(company)
#numero5
print(len(company))
#numero 6
print(company.upper())
#numero 7
print(company.lower())
#numero 8
print(company.capitalize())
print(company.title())
print(company.swapcase())
#numero 9
print(company[0:6])
#numero 10
print("Coding" in company)
#numero 11
print(company.replace("Coding","Python"))
#numero 12
sentence = "Python For Everyone"
print(sentence.replace("Everyone","All"))
#numero 13
print(company.split())
#numero 14
resaux = "Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon"
print(resaux.strip(','))
#numero 15
print(company[0])
#numero 16
print("last index is : ", len(company) - 1)
#numero 17
print(company[10])
#numero 18
acronym1 = ''.join([word[0] for word in sentence.split()])
print(acronym1)
#numero 19
acronym2 = ''.join([word[0] for word in company.split()])
print(acronym2)
#numero 20
print(company.find('C'))
#numero 21
print(company.find("F"))
#numero 22
position_sentence = "Coding For All People"
print(position_sentence.rfind('l'))
#numero 23
sentence_23 = """You cannot end a sentence with because because
because is a conjunction"""
print(sentence_23.index("because"))
#numero 24
print(sentence_23.rindex("because"))
#numero 25
print(sentence_23[31:54])
#numero 26
print(sentence_23.find("because"))
#numero 27
print(sentence_23[31:54])
#numero 28
print(company.startswith("Coding"))
#numero 29
print(company.endswith("coding"))
#numero 30
sentence_30 = ' Coding For All '
print(sentence_30.strip())
#numero 31
variable1 = "30DaysOfPython"
variable2 = "thirty_days_of_python"
print(variable1.isidentifier())
print(variable2.isidentifier())
#numero 32
libraries = ['Django','Flask', 'Bottle', 'Pyramid', 'Falcon']
print(" ".join(libraries))
#numero 33
print("I am enjoying this challenge.\nI just wonder what is next")
#numero 34
print("Name\t Age\t Country\t City\nAsabeneh\t 250\t Finland\t Helsinki")
#numero 35
radius = 10
area = 3.14 * radius ** 2
print(f"The area of a circle with radius {radius} is {area} meters square.")
#numero 36
a = 8
b = 6
print('{} + {} = {}'.format(a, b, a + b))
print('{} - {} = {}'.format(a, b, a - b))
print('{} * {} = {}'.format(a, b, a * b))
print('{} / {} = {:.2f}'.format(a, b, a / b))
print('{} % {} = {}'.format(a, b, a % b))
print('{} // {} = {}'.format(a, b, a // b))
print('{} ** {} = {}'.format(a, b, a ** b))