A
A
Andrey Godunko2021-11-17 20:51:28
Python
Andrey Godunko, 2021-11-17 20:51:28

The number is displayed 4 times, but it should be 1?

I work with files and that's when I multiply the number to me it is displayed 4 times. Of course, I understand that the problem is probably how I multiply, but tell me how to multiply so that the number is multiplied by 4. And not to show 4444

num = open('num.txt', 'r')
g = num.read(1)
fine = g*4  

print(fine)

Thanks for your help ( ̄︶ ̄)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-11-17
@Noy-name-boy

Because it's not a number, it's a string
g = int(num.read(1))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question