Een tekst is opgebouwd uit paragrafen, die van elkaar gescheiden worden door een aantal
lege regels. Schrijf een functie structuur()
met als argument de naam van een
tekstbestand, en als resultaat een lijst gehele getallen. Deze lijst bevat evenveel getallen als
er paragrafen in de tekst aanwezig zijn, en elk getal geeft het aantal tekstregels van de desbetreffende
paragraaf aan.
Eén tekstargument, namelijk de naam van het te analyseren tekstbestand
Een lijst gehele getallen zoals hierboven gedefinieerd.
De bestanden die Dodona gebruikt in de testcases vind je in het gecomprimeerde bestand tekststructuur.zip1.
structuur('TekstIn.txt') = [6, 4, 6, 5] Invoerbestand ('TekstIn.txt'): Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library. Python interpreters are available for many operating systems, allowing Python code to run on a wide variety of systems. Using third-party tools, such as Py2exe or Pyinstaller, Python code can be packaged into stand-alone executable programs for some of the most popular operating systems, so Python-based software can be distributed to, and used on, those environments with no need to install a Python interpreter. CPython, the reference implementation of Python, is free and open-source software and has a community-based development model, as do nearly all of its variant implementations. CPython is managed by the non-profit Python Software Foundation. [bron: WikiPedia]