Sabrás
- Install Python and run a first program from the terminal or an editor
- Create variables and choose appropriate data types for numbers, strings, and booleans
- Write conditionals and loops to control program flow
- Use lists, tuples, and dictionaries to store and organize data
- Define and call functions with parameters and return values
- Build a small complete Python program that combines these concepts
Conviene saber antes
- Basic comfort using a computer and opening files
- Ability to install software or follow setup instructions
Temario
8 lecciones y un proyecto final
- 1
Setting up Python and writing a first program Gratis
You will install Python and PyCharm, create a project and a Python file, and run your first lines of code with print(). You will also see how a variable stores a value that print() can show.
2 de código7 pasos de construcción2 ejercicios3 preguntas - 2
Variables and data types Beyond Pass
Aprenderás a guardar valores en variables, los tipos de datos básicos que usa Python (enteros, flotantes, cadenas y booleanos), y a pedir datos al usuario y convertirlos en un número. Al final podrás escribir un pequeño programa que pide un año de nacimiento y calcula una edad.
3 de código3 pasos de construcción3 ejercicios3 preguntas - 3
Cadenas y entrada del usuario Beyond Pass
Aprenderás cómo input() pide al usuario un texto y por qué todo valor que devuelve es una cadena. También aprenderás a convertir cadenas en números con float() y de nuevo en texto con str(), y a usar los métodos de una cadena con un punto.
2 de código3 pasos de construcción2 ejercicios3 preguntas - 4
Condicionales y comparaciones Beyond Pass
Esta lección muestra cómo Python comprueba texto y números con el operador in y el operador de resto %, y cómo calcula el orden de las operaciones en una línea de código. También muestra los operadores abreviados como += y -=.
2 de código3 pasos de construcción2 ejercicios3 preguntas - 5
Condiciones en Python: if, elif y la lógica que hay detrás Beyond Pass
En esta lección verás cómo Python comprueba condiciones con operadores de comparación y lógicos, y cómo if, elif y else deciden qué código se ejecuta. Escribirás y probarás pequeños programas que toman decisiones según un valor.
3 de código3 fórmulas3 pasos de construcción2 ejercicios3 preguntas - 6
Condicionales en la práctica: elif, else y un conversor de peso Beyond Pass
Esta lección muestra cómo encadenar varias condiciones con elif y terminar con un else que recoge todo lo demás. Después construye un pequeño conversor de peso que pide un valor y una unidad y elige el cálculo correcto.
2 de código1 fórmula4 pasos de construcción3 ejercicios4 preguntas - 7
Escribir y llamar funciones en Python Beyond Pass
Aprenderás qué es una función, cómo definirla con def y cómo llamarla. Verás cómo una función puede recibir entradas (parámetros) y reutilizarse muchas veces.
2 de código2 pasos de construcción3 ejercicios3 preguntas - 8
Diccionarios y un mini proyecto Beyond Pass
Esta lección cubre las herramientas de listas y tuplas que muestra el video, como comprobar la pertenencia con "in", recorrer con for, usar range y contar elementos con count(). Termina con el inicio de un mini proyecto, y la transcripción de este capítulo es breve, así que la lección se limita a lo que muestran los fotogramas.
5 de código2 pasos de construcción2 ejercicios3 preguntas
Proyecto final
Mini gastos de bolsillo: un programa completo de consola en Python
Crea un pequeño rastreador de gastos por línea de comandos que guarda los registros en listas, tuplas y diccionarios, pide datos al usuario con input() y los convierte con float(), toma decisiones con if/elif/else y reutiliza lógica mediante funciones. Reúne todos los resultados del curso en un solo programa funcional, y sigue el estilo del conversor de peso de la lección 6, pero para el dinero. El resultado muestra que los pequeños bloques del curso se combinan para formar una herramienta real.
Sus 7 tareas se abren con Beyond Pass.
Vista previa gratis · La lección 1 completa
Setting up Python and writing a first program
You will install Python and PyCharm, create a project and a Python file, and run your first lines of code with print(). You will also see how a variable stores a value that print() can show.
Escribe los comandos de la lección, rompe cosas y descubre por qué.
Ejecuta y cambia el código, con Python y JavaScript de verdad.
Dibuja y escribe junto al vídeo.
La idea
To write Python you need two things: the Python interpreter, which runs your code, and an editor where you type it. The video installs Python from the official Python installer (on macOS it shows Python 3.8.1 for macOS 10.9 or later) and then installs PyCharm Community Edition, a free editor made for Python. You drag PyCharm into the Applications folder like any other Mac app.
Next, open PyCharm and create a new project, here named HelloWorld. A project is a folder that holds your Python files. Inside it, right-click the project and choose New, then Python file. Name the file app.py. The .py ending tells the computer this file contains Python code.
Your first program is one line: print("Hello World"). The word print is a built-in instruction that shows whatever you put inside the brackets on the screen. The text inside the quotation marks is a string, which is a piece of text. Run the program from the Run menu (Run...), and the output Hello World appears in the panel at the bottom.
Print can also show a value stored in a variable. A variable is a name that holds a value. The line age = 20 creates a variable called age and stores the number 20 in it. The line print(age) then shows 20. Notice the difference: print("age") would show the word age, while print(age) shows the value stored under that name.
In short, you install Python and an editor, make a project and a .py file, write instructions, and run them. Each run executes the file from top to bottom, one line after another.
Puntos clave
- Python needs an interpreter (installed from the Python installer) and an editor such as PyCharm Community Edition. 1:51
- A project is a folder for your files; a Python file ends with .py, for example app.py. 4:00
- print("Hello World") shows the text Hello World; the text inside the quotes is a string. 5:01
- Run... in the Run menu executes the file, and the output appears at the bottom of the window. 5:01
- print(age) shows the value stored in the variable age, which is 20 after age = 20. 6:40
Código de la pantalla
print("Hello World")Save as app.py in your PyCharm project and press Run.
age = 20
print(age)Save as app.py in your PyCharm project and press Run.
Construye a la vez en la terminal de práctica
- Download and run the Python installer from python.org and click Continue through the steps until it finishes. 1:51Deberías ver: Python is installed on your computer.
- Drag PyCharm CE into the Applications folder, then open PyCharm. 3:01Deberías ver: PyCharm opens and is ready to create a project.
- Create a new project called HelloWorld. 4:00Deberías ver: The HelloWorld project appears in the Project panel.
- Right-click the project, choose New, then Python file, and name it app.py. 4:00Deberías ver: app.py opens in the editor.
- Type print("Hello World") into app.py. 5:01Deberías ver: The line is shown in the editor.
$ print("Hello World") - Choose Run from the Run menu (or press the run button). 5:01Deberías ver: The output Hello World appears at the bottom.
- Replace the code with age = 20 and print(age), then run again. 6:40Deberías ver: The output shows 20.
$ print(age)
Práctica
Create a variable called name that stores the text "Sara" and print it.
# Write your code below
Pista
Strings go in quotes. A variable is made with name = value, and print(name) shows its value.
Solución
- Create the variable: name = "Sara".
- Print the variable: print(name).
- Running it shows Sara (no quotes, because print shows the value).
name = "Sara"
print(name)Sara
A file has these lines: age = 20, then print(age), then age = 25, then print(age). What are the two numbers printed, added together?
Pista
Lines run from top to bottom, so the second print sees the new value of age.
Solución
- The first print(age) runs when age is 20, so it prints 20.
- Then age becomes 25, and the second print(age) prints 25.
- 20 + 25 = 45.
45
En tu bloc de notas
Draw a box labelled age, and write 20 inside it. Next to it, sketch what print(age) puts on the screen.
Test
What does the file ending .py tell the computer?
- The file is a picture
- The file contains Python code
- The file is a folder
- The file is encrypted
Mostrar la respuesta
B. The file contains Python code · Files ending in .py hold Python code that the interpreter can run.
4:00 ver el momentoAfter age = 20, what does print(age) show?
- age
- 20
- age = 20
- an error
Mostrar la respuesta
B. 20 · print(age) shows the value stored in the variable age, which is 20.
6:40 ver el momentoWhich editor does the video install to write Python?
- Word
- PyCharm Community Edition
- Excel
- Photoshop
Mostrar la respuesta
B. PyCharm Community Edition · The video installs PyCharm Community Edition, a free Python editor.
3:01 ver el momento
Lecciones 2–8 y el proyecto final
Se abren con Beyond Pass: todas las lecciones de todos los cursos, completas. Un solo pago: 14,99 $ por 90 días o 29 $ por un año. Sin suscripción.
Hecho por Beyond a partir del vídeo «Python for Beginners - Learn Coding with Python in 1 Hour» de Programming with Mosh. El vídeo se reproduce en el propio reproductor de YouTube. Míralo en YouTube · Todas las lecciones
