Python

No description

fork
loading
Files
  • main.py
main.py
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
# A string

s = "Hello all!"
print (s)

s1 = "A string \
in many \
lines"
print (s1)

# New lines
s2 = "line 1\nline 2\nline 3"
print (s2)

# Extraire la deuxième lettre "e" de la variable s2:
print (f"second e = {s2[2]}")


#print (s[11])

# String Methods
# Search for the first letter "m" in s1
print (f"r se trouve à la position: "+str(s1.find('r')))

print (s2.find("\n"))

print (s2.rfind("e"))

s3 = "You're a poor person... Really a poor person !"
#s3 = s3.replace("poor","important")
print (s3)

# 
print (s3.replace("You're a poor person... Really a poor person !","poor"))
print (s3[9:13])