Giter VIP home page Giter VIP logo

pyzombis's Introduction

Python para Zombis

Programación Python para Zombis MOOC (código y materiales del curso abierto y masivo en linea) en preparación

Versión preliminar en linea:

Contenidos:

  • lectures: presentaciones para preparar las clases (vídeos)
  • lab: trabajos prácticos semanales (guía de ejercicios) con evaluación y calificación automatizada, implementados para el Laboratorio Virtual de Programación VPL de Moodle
  • quiz: cuestionarios rápidos con problemas simples de programación a implementar con CodeRunner en Moodle

Quick Start

Dev tutorial: https://github.com/PyAr/PyZombis/wiki/Development-HOW-TO

Docker Environment

To run the project in a Docker environment, run the following;

docker build . -t pyzombis
docker run -p 127.0.0.1:4000:4000/tcp pyzombis

Open your browser and access the resources on 127.0.0.1:4000

Licencia

Esta obra, basada originalmente en el trabajo de Fernando Masanori Ashikaga Python para zumbis, está bajo una Licencia Creative Commons Atribución-CompartirIgual 2.5 Argentina.

CC BY-SA 2.5 AR

El código fuente se publica bajo la Licencia Pública General Affero GNU versión 3 o superior.

AGPLv3

Algunos contenidos de terceros pueden estar governados por sus respectivas licencias.

pyzombis's People

Contributors

abadoni5 avatar angelaremolina avatar edvm avatar evananyonga avatar ironvenom avatar its-chatty avatar ivanuxowo avatar leocumpli21 avatar mdelgadonyc avatar nicolassandoval avatar oscarvogel avatar patriciacatandi avatar reingart avatar shivamshan avatar sujith-rek avatar tzulberti avatar xpushpeshx avatar y-martinez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyzombis's Issues

Improve Web development sample with an SPA [TWP60]

The idea will be rewrite the lesson as a Single-Page-Application, so it can avoid to install a server (web2py, django or flask)
The original lecture has a very simple visitor count using the session

IMPORTANT: a more elaborate example will be great!

TIPs:

  • Write the UI directly as HTML5 activity (editable blocks)
  • Use local storage for persistence
  • Use brython to code implement events (editable blocks)

Affected pages:

Please add E2E Playwright tests

Modernize multimedia app & Object-Oriented Programming lecture [TWP56] [TWP58]

The DJ mix a sample app to play music, with a mixer to control the volume: mock-up

The original lesson uses Tkinter GUI for desktop apps, looking outdated and requiring a PC to execute it.
The idea is to revise and rewrite the code for the web (HTML5) and make the lesson interactive in the browser

TIPs:

  • Use Brython to create the HTML UI programatically
  • Implement events handlers with Brython

See previous lessons for examples about Brython and MVC TWP50

Affected pages:

Please add E2E tests with playwright

Reto 1 falla por syntaxis de json (request a API externa)

Error en https://pyar.github.io/PyZombis/main/challenges/Reto01.html

ExternalError: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data on line 8

Aparentemente no puede descargar de la API de universidades un json válido.
El error se puede ver en la consola del inspector del browser:

Firefox:

Bloqueado al cargar contenido de visualización mixto "http://universities.hipolabs.com/search"

Chrome:

Mixed Content: The page at 'https://pyar.github.io/PyZombis/main/challenges/Reto01.html' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://universities.hipolabs.com/search'. This request has been blocked; the content must be served over HTTPS.

https://universities.hipolabs.com/search no funciona, por lo que tendríamos que buscar otra API que funcione por https y permita bajar ciudades
Plan B: guardar el json de ciudades en un archivo en nuestra propia página (adjunto al ejercicio), para no tener que descargarla

Starbuzz CORS error [TWP33]

Refactor modular programming chapter [TWP47]

This topic has several issues for a client-side web platform: lack of file-write persistence, many modules and import difficulties, etc.
The idea is to revise the lesson and rewrite a more interactive coding examples and exercises

TIPs:

  • use Brython Session Storage to wrap a file-like to store data
  • several tabs could hold the code in the same page, so "dynamic" import could be implemented for editable code, see quiz 1

Affected pages:

Please add E2E test with Playwright for the complete chapter

Fix/Rewrite Examples to Embrace Runestone Available Python Features

I am facing the following 2 issues after finishing work on the examples -

  1. I am not able to create interactive examples in the case of a bit advanced examples which require the use of external libraries like urllib, pygame, tkinter, etc. using the activecode component as it doesn't seem to work after the build is made. I have tried to make the examples using activecode , it is not working.

  2. When an example needs to read data from a .txt file, we need to use the Datafile component so as to make the example interactive, as the activecode reads data from it. But when I am using it, it is giving me the following error-

Unable to save to source_code table in datafile__init__.py. Possible problems:
  1. dburl or course_id are not set in conf.py for your book
  2. unable to connect to the database using dburl

This should only affect the grading interface. Everything else should be fine.`

And the build cannot be made when we use the datafile component

Simplify random number guess exercise [TWP30]

This lecture is about repetitions, but it has a lot of GUI code to create a button and wait (and has no while loop)
The extra code should be removed, trying to respect the original exercise: TWP30.rst

print('¡Bienvenido!')
numero = 0
while numero != 42:
  g = input('Ingrese un numero: ')
  numero = int(g)
  if numero == 42:
    print('¡Ganaste!')
  else:
    if numero > 42:
      print('Alto')
    else:
      print('Bajo')
print('Fin del juego!')

The time.sleep() is needed to refresh the page

Please add an E2E tests with Playwright

Write exercises for initial chapters

Initial chapters about numbers, strings, conditions and loops don't have proper exercises with automatic grading (just a placeholder with an "Einstein" picture)

Fixing #245 could allow to write simple exercises to give early feedback to students

Developed excercises should be basic, ideally the same shown in the lectures.
For example:

  • hello world
  • greet (ask the user name and print )
  • ask day of birth and print age
  • basic string manipulation
  • list manipulation, sort, etc.
  • conditions (rock, paper, scissors game)
  • loops (counter, accumulator, average)

Adding Interactive assignments.

Converting the assignments of the original project to interactive ones using Runestone components and adding them to the project.
The following assignments are to be converted -

  • Lista 06 CodingBat
  • Lista 07 CodingBat
  • Lista 09 CodingBat
  • Lista 10 CodingBat
  • Lista 11 CodingBat
  • Lista 12 CodingBat
  • Lista 13 CodingBat
  • Lista 14 CodingBat
  • Lista de Exercícios IIIb
  • Lista de Exercícios V
  • Lista Extra 1
  • Lista Extra 2

There are two assigments that I have removed from the list because they cannot be created using Runestone components.

An issue was filed in the Runestone Components Repository -RunestoneInteractive/RunestoneComponents#833 .
This was regarding the restoration of answers in the MCQ component that has been used in Lista de Exercícios V which is the file Quiz5mcq.

Add CodeLens to activities

Debugging

Checking for minor errors and removing final bugs. Updating documentation.

Serve via runestone

The original course was already migrated to Restructured Text, but a proper structure using Runestone Interactive is needed to serve it as a simple web-app.

Please take a look to a simple sample project py101: interactive python lessons taken from a university course (FIUBA)

Sample online build: http://www.web2py.com.ar/runestone/static/py101/index.html

At this stage, only the lectures should be adapted to be served via Runestone (see Workshop 2017 for a more complete skeleton and info).

Quick sample startup:

git clone https://github.com/reingart/py101.git
mkvirtualenv pyzombis
pip install runestone
cd py101
runestone build
cd build/py101 ; python -m SimpleHTTPServer 8000

The last command serves the interactive book it localy.

You could also copy the book a web2py server, just do:

cp build/py101 ../web2py/applications/runestone/static/ -r

TL;DR: for PyZombis probably you should add a pavement.py and conf.py, to replace and simplify the sphinx machinery

For complete build instructions and server setup, see: Runestone documentation

Quiz 1 - problemas con el verificador

En el ejercicio 8 del Quiz 1 da un error al verificar, aparentemente por redondeo. Adjunto capturas del caso que el verificador encuentra error y del caso que el verificador toma correcto.

Capture1

Capture2

En el ejercicio 12 del Quiz 1 me da error el verificador aunque la fórmula es correcta, aparentemente es una cuestión de números demasiado grandes. Adjunto captura.

Capture3

Unit test to grade input/output beginner exercises

Initial programs don't use def so they cannot be invoked in unit test to check results programmatically, for example:

https://pyar.github.io/PyZombis/main/lectures/TWP15/TWP15_3.html#algunos-ejercicios

But, we could include hidden code to wrap input and print functions, so later we can evaluate them.

Proof-of-Concept:

# wrap functions to store inputs and outputs
inputs = []
outputs = []

i = input
def input(msg):
    v = i(msg)
    inputs.append(v)
    return v

p = print
def print(v):
    p(v)
    outputs.append(v)

# student code:
n = input("n")
print(int(n) + 2)

# automatic check / grading:
assert not inputs, "your program must read input data"
assert not outputs, "your program must print output results"
assert outputs[0] == int(inputs[0]) + 1, "you must sum 1"

Documentation:
https://runestone.academy/ns/books/published/authorguide/directives/activecode.html#incorporating-unit-tests

Parsons to teach indentation

Chapter about indentation has no interactive activity:

https://pyar.github.io/PyZombis/main/lectures/TWP30/TWP30_2.html

Add a Pearson exercise to illustrate concepts and self-assessment:
https://runestone.academy/ns/books/published/authorguide/directives/parsons.html

Sample (please modify with the examples in the chapter):

.. parsonsprob:: par_ex_group1

   Construct a function that returns the max value from a list.
   -----
   def findmax(alist):
       if len(alist) == 0:
           return None
       curmax = alist[0]
       for item in alist:
           if item > curmax:
               curmax = item
       return curmax

Adapt assignments to use Runestone's ActiveCode

The simple quiz (simple exercises) should be converted to interactive python scripts using ActiveCode Runestone's plugin.

In the original course, assignments should be downloaded and executed with a local python environment.

Runestone solves this thanks to an embebed python interpreter in the browser, so it doesn't have any annonyance, being fast and scalable.

Refactor GUI wrapper for Brython

We're using the Brython dialog widget in some sample apps: TWP50

This requires to build on the fly the UI with HTML, and introduce more concepts

A simplified class to create widgets would be great

If it could mimic Tkinter, GTK, WxPython or QT it would be great, so advanced student could practice in his own notebook.
Or a web alternative could be used JQueryUI

Original exercises are written in Tkinter, see for example #217 and #218, see original code for objects and methods that would need to implement: TWP50

For a preliminary tkinter Brython port see: https://github.com/PierreQuentel/tkinter

Create Script to Extract Translation Messages

As result we should be able to run a script against the project and get all the translation strings. This should be addressed after #29
Bear in mind that the script should be Continuous Integration friendly.

Refactor lecture TWP42: Bases de datos

This lecture has codeblocks for sqlite3 code instead of having an interactive activecode like other lectures. This is because Runestone does not support the sqlite3 library from python. Bython does not support it either.

Because of these reasons it is needed to find a way to use sqlite3 inside the book or replan this lecture in a way to teach with SQL.

By far there has been 3 attemps of refactoring the lecture, here they are order by closest to the solution:

  1. Using the activecode SQL languge from Runestone: #185
    Some configuration to use this SQL tool from Runestone must be done, because when you try to access the file surf.db, a CORS error shows up in console and nothing is shown. There might be something related with the book not being served by Runestone because in this error it tries to access to the db from an URL in runestone site: /runestone/books/published/PyZombis/_static/sql-wasm.wasm asuming that the book is published.

  2. Using sql.js library from javascript: #184
    This other option loads the database using the .. raw:html instruction from runestone.
    This is the best attempt since you need to find a way to access to the global javascript variable db from the brython activecode block. Enter this PR for more detail, but if you call db in browser console you can see the database.

  3. With indexedDB: #171
    This aproach works, but the syntax changes a lot from the original lecture where sqlite3 was used.

For example:

cursor.execute("select * from surfers  where age > 25")
linhas = cursor.fetchall()
for linha in linhas:
    print("id :",linha['id'])
    print("Nombre :",linha['name'])
    print("Pais  :",linha['country'])
    print("Media  :",linha['average'])
    print("Estilo :",linha['board'])
    print("Edad  :",linha['age'])
    print()

had to change to:

if(getattr(v, "edad") >=25):
    for key in ["nombre", "pais", "media", "estilo", "edad"]:
        print(f"{key}: {getattr(v, key)}")
  getattr(res, "continue")()

It is not a friendly syntax for new students that are learning this for the first time.

Modernize MVC & exceptions example app [TWP52] [TWP54]

This is a simple app to teach Model View Controller concepts: mock-up

The original lesson uses Tkinter GUI for desktop apps, looking outdated and requiring a PC to execute it.
The idea is to revise and rewrite the code for the web (HTML5) and make the lesson interactive in the browser

TIPs:

  • Use Brython to create the HTML UI programatically
  • Implement events handlers with Brython

See previous lessons for examples about Brython and MVC TWP50

Affected pages:

Please add E2E tests with playwright

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.