Skip to content

Latest commit

 

History

History

0x0B-python-input_output

Python - Input/Output

Technologies

  • Files written in vi, vim, and emacs editors.
  • Files wriiten according to the betty coding style. Checked using betty-style.pl and betty-doc.pl.
  • Files tested on Ubuntu 20.04 LTS using gcc.
  • Python3.4 files

Files

File Question
0-read_file.py Write a function that reads a text file (UTF8) and prints it to stdout:
1-write_file.py Write a function that writes a string to a text file (UTF8) and returns the number of characters written:
2-append_write.py Write a function that appends a string at the end of a text file (UTF8) and returns the number of characters added.
3-to_json_string.py Write a function that returns the JSON representation of an object (string)
4-from_json_string.py Write a function that returns an object (Python data structure) represented by a JSON string.
5-save_to_json_file.py Write a function that writes an Object to a text file, using a JSON representation.
6-load_from_json_file.py Write a function that creates an Object from a “JSON file”.
7-add_item.py Write a script that adds all arguments to a Python list, and then save them to a file.
8-class_to_json.py Write a function that returns the dictionary description with simple data structure (list, dictionary, string, integer and boolean) for JSON serialization of an object.
9-student.py Write a class Student that defines a student by: Public instance attributes: first_name, last_name, age
10-student.py Write a class Student that defines a student by: (based on 9-student.py) Public instance attributes: first_name, last_name,age.
11-student.py Write a class Student that defines a student by: (based on 10-student.py) Public instance attributes: first_name, last_name,age.
12-pascal_triangle.py Create a function def pascal_triangle(n): that returns a list of lists of integers representing the Pascal’s triangle of n: Returns an empty list if n <= 0. You can assume n will be always an integer. You are not allowed to import any module.
100-append_after.py Write a function that inserts a line of text to a file, after each line containing a specific string.
101-stats.py Write a script that reads stdin line by line and computes metrics.