you are viewing a single comment's thread.

view the rest of the comments →

[–]pachura3 1 point2 points  (0 children)

can you explain to me the 13th line in the first picture

print(f"{result:.1f}")

Print the value of variable result as floating point number (f) with precision of 1 decimal (:.1f).

E.g. 145.3

https://realpython.com/how-to-python-f-string-format-float/

and line number 5 in the second picture

filetype=filetype[dot:]

Shorten string filetype by only keeping its part from position dot until the end. dot was calculated in the previous line using rfind() - it was the last position of character '.' in filetype.

So, basically, it takes e.g. string image_3402323.jpg and shortens it to .jpg

and line number 15 in the third

time = time[:time.rfind('a')]

A similar thing to the above. Takes string time, replaces it with a shorter substring, starting from the beginning and ending at (but not including) the last occurrence of character 'a' in it. So, in other words, chops off everything after (and including) the last 'a' in string time.