I'm extremely new to python and I'm trying to learn. I have a text file containing this:
1 Lebron 30 5
1 Curry 29 8
1 Durant 20 4
2 Lebron 35 3
2 Curry 39 6
2 Durant 15 8
3 Lebron 25 6
3 Curry 30 5
3 Durant 21 5
I want to be able to input a name and get the first, third, fourth and a multiplication of the third and fourth column.
I know how to ask for the name, but I can't get further than that. I imagine something like a text split and a for loop.
This is what I have done so far
fileName = input("Enter the file name: ")
playerName = input("Enter the player name: ")
inputFile = open(fileName, 'r')
text = inputFile.read()
print("%4s % 8s % 10s % 12s" % \
("game", "Points",
"Assists", "PointsxAssists"))
words = len(text.split())