I want to assign a formatted string to a variable. For example, I would write the following in Python:
my_score = 100
line = "score = %d" % my_score
print(line)
This will print the following:
score = 100
How to write the same in Fortran?
The direct implementation of Your code would be something like:
program test
integer :: score
character(len=30) :: line
score = 100
write(line, '(a, i3)') "score = ", score
print '(a)', line
end program test