Number is, which numbered the measurement series

Number is, which numbered the measurement series

The example folder from task 11.1 contains a number of csv files named measurement_series_x, where x is a number that numbers the measurement series. Merge all measurement series to a new csv file. To do this, proceed as follows:

– Use the for task 11.1 created class files to find all csv files of the folder. – Check for each csv file that it belongs to the measurement series, d.H. That the name follows the above scheme. Use for reading. Writing csv files the module csv. The measuring points in a row are separated by commas each time.

Task 12.2

1.) Write a class House with the attributes address (string), height (float number) and number of floors (integer number).

1. The address is to be stored as a private attribute. Write a get method with which the address can be queried. 2. The class should contain an overloaded print function, so that the address, the height and the number of floors are output via print. 3. Add a static attribute Number_House to your class House. Number_house should always count the number of instances of the class created so far in the whole script. 4. Overload additionally the smaller comparison operator (operator: __lt__). A house is to be considered smaller than a second house if it is lower (height lower).

Check your implementation with suitable input in the section 'main'. Z.B.:

2.) Write a class Skyscraper that is derived from the class House. It should have the attribute Name (string) in addition to the attributes of house. Skyscrapers are usually identified by their name. Not known about its address (z.B.B. DC-Tower, Donauturm, Empire-state-building,…).

1. Overload the print function for the class skyscraper, so that a string containing all attributes of skyscraper can be output with print. 2. Add a static attribute Number_skyscrapers to your class Skyscrapers. Number_cloudscratchers should always count the number of instances of the class created so far in the entire script.

Z.B.:

3.) Write a function Read_Haeuser in a new python file (should not be a class method!). This function is passed the name of a csv file containing a list of houses.

1. Import your classes house and skyscraper. 2. The function should first check if the file can be opened using exception handling.

– If no, a helpful hint containing the type of error shall be returned. – If yes, the csv file should be read in.

1. The csv file contains several lines, where each line contains one house or. Defines a skyscraper (see example below):

– A building is defined in the csv file as follows: Address, Height, Number of floors – A skyscraper is defined in the csv file as follows: Address, Height, Number of floors, Name

Read the file and create a list of house and skyscraper objects, where each line of the file should be used to initialize a house or a skyscraper.

1. Then you want to sort this house list in ascending order using the overloaded smaller operator, d.H. Be sorted by height. The sorted list of houses is to be returned. The Python functions sort. Sorted use the smaller operator for sorting. – In order to use the overloaded print operator to output the list of houses and skyscrapers, a loop over the list must be used. – A longer file "Input_Haeuser2.Csv" to test your solution can be found on the Tuwel page of the LVA.

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: