GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Hello-Python/Hello-Python/Basic/00_helloworld.py at main · mrtngrsbch/Hello-Python

Expand file tree

/

00_helloworld.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
66 lines (51 loc) · 2.35 KB
/

00_helloworld.py

Copy path

File metadata and controls

66 lines (51 loc) · 2.35 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
66
"""
Clase 01 — Hello World e I/O básico (input/print)
Propósito:
- Imprimir mensajes en consola con print()
- Diferenciar comentarios de una línea y docstrings/bloques multilínea
- Reconocer tipos básicos con type()
- Practicar un pequeño bloque de entrada/salida (opcional)
Cómo ejecutar:
- python3 Hello-Python/Basic/00_helloworld.py
Nota: hay un bloque de práctica con input comentado para no bloquear pruebas. Lee el flujo y luego descoméntalo si quieres interactuar.
"""
from __future__ import annotations
def demo_hello_world() -> None:
"""Demostración mínima de impresión en consola."""
print("Hola Python")
print('Hola Python') # Comillas simples o dobles, ambas funcionan
def demo_comments_and_docstrings() -> None:
"""Muestra diferentes tipos de comentarios.
- El texto entre triple comillas al inicio del archivo es un docstring de módulo.
- Este docstring pertenece a la función.
- Las líneas que empiezan con # son comentarios de una sola línea.
"""
# Esto es un comentario de una línea (no se ejecuta)
"""
Este es un bloque de texto multilínea que, si no se asigna a una variable,
suele usarse como comentario de varias líneas. Técnicamente Python lo
interpreta como un literal de cadena no usado.
"""
def demo_basic_types() -> None:
"""Repaso de tipos básicos y la función type()."""
print(type("Soy un dato str")) # str (cadena de texto)
print(type(5)) # int (entero)
print(type(1.5)) # float (coma flotante)
print(type(3 + 1j)) # complex (número complejo)
print(type(True)) # bool (booleano)
print(type(print("Mi cadena de texto"))) # NoneType (print no devuelve nada)
# Bloque de práctica (comentado para no interrumpir ejecuciones automatizadas)
# 1) Descomenta y ejecuta el archivo. Escribe tu nombre cuando te lo pida.
# 2) Observa la salida.
# 3) Prueba a cambiar el mensaje.
#
# name = input("¿Cuál es tu nombre? ")
# print(f"Encantado, {name}!")
# Checklist mental (comentado)
# - print(): ¿entiendo que imprime y no devuelve valor (None)?
# - type(): ¿puedo reconocer str, int, float, bool, complex?
# - Comentarios: # para una línea, triple comillas para docstrings/bloques.
if __name__ == "__main__":
demo_hello_world()
demo_comments_and_docstrings()
demo_basic_types()
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.