'Why can't i type a float as an integer in my f-string

I had a class that was already connected to a csv file so i couldnt add 'marathon' there.

The query was that a club wants to display the number of whole marathons each member has walked. A marathon is 26.22 miles long.

An example of the calculation required is:

If Nikolai Bryant walks 145.6 miles this equates to: 145.6/26.22 miles = 5.59115179 marathons
Nikolai has therefore walked 5 whole marathons.

In the above example ‘Nikolai,Bryant,5’ would be stored.

Write “The number of whole marathons walked by each member is” to the results.txt file

Start loop for each record in members() array

Calculate the number of whole marathons walked

Write the forename, surname and the number of whole marathons to the results.txt file and loop

Close the results.txt file

I had this which tried to make marathon a new variable since adding it to the class not in this code would've caused an error

def output_it(members, furthest):
  of=open("results.txt", "a")
  of.write('The number of whole marathons walked is:\n')
  for loop in range(len(members)):
    int(marathon=round(1, members[loop].distance/26.22))
    of=open("results.txt", "a")
    of.write(f'{members[loop].forename} {members[loop].surname} {marathon}')
    
#Meinne programme
members=read_data_to_AOT()
furthest=find_furthest_distance(members)
display_fursthest_distance_walked(furthest, members)
output_it(members, furthest)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source