Question: I have a text file that is similar to this:

```
line 1: a b c,
line 2: d e f,
line 3: g h i

```

I need to write a python code that reads the file and print the first value of each line and multiply the last two to something like this:

```
line 1: a, bc 
line 2: d, ef
line 3: g, hi

```

Please help anyone

EDIT: a, d and g are non numeric values, b, c, e, f, h and i are numeric values

Answer: 
An alternative:

```
with open(filename) as file:              # Opens the file
    for line in file:                     # Loops through each line in file.
        line = line.rstrip()              # Removes any spaces in the right.
    a, b, c = line.split(" ")             # Split based on spaces
    print(a + " " + str(int(b) * int(c)))

```

In the last line b and c are converted to `integer`, multiplied and then changed to `str` again so that our final string can be prepared for `print()`.
Here is the code that you need:

```
with open('input.txt', 'r') as file:
   numbers = []
   for line in file.readlines()[1:]:
      for number in line.replace(',', '').split(' '):
         numbers.append(number)
      print(f'{number[0]}, {float(number[1])*float(number[2])}')

```