f = open("program0.4.txt", "w")
done = input('Enter done for last name when finished')
Last_Name = input("Enter Last Name: ")
while Last_Name != 'done':

First_Name = input("Enter First Name: ")
Hrs_Wrkd =int(input("Enter Hours Worked: "))
Hrly_Wge = int(input("Enter Hourly Wage: "))
f.write('Last Name' + '   ' + 'First Name' + '   ' + 'Salary' + "\n")
Last_Name = input('Enter Last Name: ')

f.close()

f = open("program0.4.txt", "r")
line = f.read()
for line in f:

info = f.split()

Salary = Hrs_Wrkd * Hrly_Wge
print(line)

print(Last_Name, "        ", First_Name, "        ", Salary)

f.close()

First off, you should be made aware that the forum software does not by default maintain the formatting of code; in order to get the code to stay formatted, you need to enter it using the 'CODE' button at the top of the editing window, else manually indent it by an additional four spaces.

f = open("program0.4.txt", "w")
done = input('Enter done for last name when finished')
Last_Name = input("Enter Last Name: ")
while Last_Name != 'done':

    First_Name = input("Enter First Name: ")
    Hrs_Wrkd =int(input("Enter Hours Worked: "))
    Hrly_Wge = int(input("Enter Hourly Wage: "))
    f.write('Last Name' + ' ' + 'First Name' + ' ' + 'Salary' + "\n")
    Last_Name = input('Enter Last Name: ')

f.close()

f = open("program0.4.txt", "r")
line = f.read()
for line in f:

    info = f.split()

Salary = Hrs_Wrkd * Hrly_Wge
print(line)

    print(Last_Name, " ", First_Name, " ", Salary)

f.close()

Second, while it is certainly helpful for you to post your code, we also need to know what the problem you are having with it is. Could you give us some details about the project, and where it is failing?

Without knowing what the problem at hand is...

The preferred way of reading a file line by line is:

with open('filename.txt') as fp:
    for line in fp:
        print(line)

Your code opens program0.4.txt, reads everything into a string. Then you split this string by space and enter. So your line variable will iterate over the nonspace characters of the file in the end. I suppose, this is not what you wanted.

i appologize for not specifying what the problem was. there seems to be a problem trying to output other people's information after the final input is made. for example the output i recieved:

Enter done for last name when finished
Enter Last Name: dominic
Enter First Name: johnson
Enter Hours Worked: 23
Enter Hourly Wage: 13
Enter Last Name: derick
Enter First Name: john
Enter Hours Worked: 13
Enter Hourly Wage: 12
Enter Last Name: done
Last Name   First Name   Salary
Last Name   First Name   Salary

done          john          156
>>> 
This question has already been answered. Start a new discussion instead.