r/PythonLearning • • 28d ago

Showcase I Can't Understand What Is Happening.

Post image
2 Upvotes

7 comments sorted by

3

u/JeremyJoeJJ 28d ago

If you meant to turn the inputs into integers, then you need to pass the variable into the int() function, so v = int(v), otherwise int() just gives you 0 I think, so you did print(0*0) and got zero in the end.

2

u/Slight-Living-8098 28d ago

You have overrided the the variables back to 0 when you assigned them with int() (which is 0 by default), so by the time your code gets to print it's 0*0

The easiest way is to declare your variables as an int(), then call the input() function inside the int()

v = int(input())
c = int(input())

print(v*c)
→ More replies (4)

2

u/Fluffy_white_fox 25d ago

Because you're reassigning the variables' value to int() which by default is 0 and 0*0 is 0 Try this instead -

v = int(v)

c = int(c)

now it's updating v and c to int Or you could just do int(input()) in the first line to type cast