• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 4 páginas
Notas de lectura

Class notes Cs50

Document preview thumbnail
Vista previa 1 fuera de 4 páginas

These notes provide an overview of Lecture 6 from CS50x 2024, introducing Python as a higher-level programming language. They cover essential concepts such as Python’s simplified syntax compared to C, object-oriented programming, loops, conditionals, and exceptions. The notes also include practical examples like image processing, face detection, and working with data structures like lists and dictionaries. Additionally, the lecture highlights Python’s use of libraries and command-line arguments, illustrating the language’s versatility and ease of use for both beginners and experienced programmers.

Vista previa del contenido

Python and Key Programming Concepts**

---
Python, a higher-level language designed for simplicity and efficiency. Python
builds on concepts learned in C but offers an easier syntax and automatic memory
management, making it ideal for quickly writing functional programs.

---

### Key Topics:

- **Python Introduction**:
- Unlike C, Python is interpreted, meaning you don’t need to compile your code
separately. Programs are executed directly in the Python interpreter.

- **Simplified Syntax**:
- Example: In C, you write:
```c
#include <stdio.h>
int main(void) {
printf("hello, world\n");
}
```
- In Python:
```python
print("hello, world")
```

- **Functions in Python**:
- Python makes functions easier to write and manage. For example:
```python
def check(word):
"""Returns True if word is in dictionary"""
return word.lower() in words
```

- **Working with Files**:
- Python simplifies file handling and memory management. For instance, to load a
dictionary:
```python
def load(dictionary):
with open(dictionary) as file:
words.update(file.read().splitlines())
return True
```

---

### Practical Examples:

- **Blurring an Image**:
- Using the PIL (Pillow) library, blurring an image is as simple as:
```python
from PIL import Image, ImageFilter
before = Image.open("bridge.bmp")
after = before.filter(ImageFilter.BoxBlur(1))
after.save("out.bmp")
```

Información del documento

Subido en
18 de septiembre de 2024
Archivo actualizado en
18 de septiembre de 2024
Número de páginas
4
Escrito en
2024/2025
Tipo
Notas de lectura
Profesor(es)
David mallan
Contiene
Week 6
$8.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
1
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes