Last active
March 30, 2021 13:27
-
-
Save dz0/6d854f54c71567e03bad826b02c36b06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # palyginimui su https://www.facebook.com/photo.php?fbid=10158413583218323&set=p.10158413583218323&type=3 | |
| def varza(grandine): | |
| R = 0 | |
| for varzu_eil in grandine: | |
| atvirkstiniu_suma = sum(1/x for x in varzu_eil) | |
| R += 1 / atvirkstiniu_suma | |
| return R | |
| # nuskaitymas C++ srauto formatu nedėkingas Python'ui, geriau būtų JSON | |
| with open("Duom1.txt") as duom: | |
| eilutes = duom.readlines() | |
| matrica = [eil.split()[1:] for eil in eilutes] | |
| R = varza(matrica) | |
| with open("Rez1.txt") as rez: | |
| rez.write(round(R, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment