FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Hello-Python/Basic/03_strings.py at main · jgrisalescode/Hello-Python · GitHub
jgrisalescode
/
Hello-Python
Public
forked from
mouredev/Hello-Python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Hello-Python
/
Basic
/
03_strings.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
65 lines (46 loc) · 1.45 KB
Breadcrumbs
Hello-Python
/
Basic
/
03_strings.py
Copy path
File metadata and controls
65 lines (46 loc) · 1.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=8643
### Strings ###
my_string
=
"Mi String"
my_other_string
=
'Mi otro String'
print
(
len
(
my_string
))
print
(
len
(
my_other_string
))
print
(
my_string
+
" "
+
my_other_string
)
my_new_line_string
=
"Este es un String
\n
con salto de línea"
print
(
my_new_line_string
)
my_tab_string
=
"
\t
Este es un String con tabulación"
print
(
my_tab_string
)
my_scape_string
=
"
\\
tEste es un String
\\
n escapado"
print
(
my_scape_string
)
# Formateo
name
,
surname
,
age
=
"Brais"
,
"Moure"
,
35
print
(
"Mi nombre es {} {} y mi edad es {}"
.
format
(
name
,
surname
,
age
))
print
(
"Mi nombre es %s %s y mi edad es %d"
%
(
name
,
surname
,
age
))
print
(
"Mi nombre es "
+
name
+
" "
+
surname
+
" y mi edad es "
+
str
(
age
))
print
(
f"Mi nombre es
{
name
}
{
surname
}
y mi edad es
{
age
}
"
)
# Desempaqueado de caracteres
language
=
"python"
a
,
b
,
c
,
d
,
e
,
f
=
language
print
(
a
)
print
(
e
)
# División
language_slice
=
language
[
1
:
3
]
print
(
language_slice
)
language_slice
=
language
[
1
:]
print
(
language_slice
)
language_slice
=
language
[
-
2
]
print
(
language_slice
)
language_slice
=
language
[
0
:
6
:
2
]
print
(
language_slice
)
# Reverse
reversed_language
=
language
[::
-
1
]
print
(
reversed_language
)
# Funciones del lenguaje
print
(
language
.
capitalize
())
print
(
language
.
upper
())
print
(
language
.
count
(
"t"
))
print
(
language
.
isnumeric
())
print
(
"1"
.
isnumeric
())
print
(
language
.
lower
())
print
(
language
.
lower
().
isupper
())
print
(
language
.
startswith
(
"Py"
))
print
(
"Py"
==
"py"
)
# No es lo mismo
Back
|
FazBrowse Home
|
New Git URL