Mutaf-Volodymyr / 290724-ptm

This repository was created as a training for the 290724-ptm group.
0 stars 2 forks source link

create generator function txt_to_dict() #8

Open Mutaf-Volodymyr opened 1 month ago

Mutaf-Volodymyr commented 1 month ago

A planets.txt file containing information about the various planets is available to you. https://github.com/Mutaf-Volodymyr/290724-ptm/blob/main/txt_to_dict/planets.txt

Implement the generator function txt_to_dict(), which takes no arguments.

The function should return a generator that generates a sequence of dictionaries, each containing information about the next planet from the planets.txt file, namely its name, diameter, mass, and orbital period. For example:

{‘Name’: ‘Mercury’, ‘Diameter’: ‘4879.4’, ‘Mass’: ‘3.302×10^23’, ‘OrbitalPeriod’: ‘0.241’}