Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Ambdós costats versió prèvia Revisió prèvia
info:cursos:pue:python-pcpp1:m4:2.1 [19/01/2024 09:49] – [Lab 1] mateinfo:cursos:pue:python-pcpp1:m4:2.1 [19/01/2024 09:59] (actual) – [solution] mate
Línia 75: Línia 75:
 print(answer[:answer.find('\r')]) print(answer[:answer.find('\r')])
 </code> </code>
 +
 +== Lab 2
 +Take a look at these two screenshots. They present two different use cases of the same program:
 +{{ :info:cursos:pue:python-pcpp1:m4:pasted:20240119-095816.png }}
 +{{ :info:cursos:pue:python-pcpp1:m4:pasted:20240119-095837.png }}
 +
 +Your task is to write a code which has exactly the same conversation with the user and:
 +
 +  - defines a class named **Vehicle**, whose objects can carry the vehicle data shown above (the structure of the class should be deducted from the above dialog — call it "reverse engineering" if you want)
 +  - defines a class able to encode the Vehicle object into an equivalent JSON string;
 +  - defines a class able to decode the JSON string into the newly created Vehicle object.
 +
 +Of course, some basic data validity checks should be done, too. We're sure you're careful enough to protect your code from reckless users.
  • info/cursos/pue/python-pcpp1/m4/2.1.1705686542.txt.gz
  • Darrera modificació: 19/01/2024 09:49
  • per mate