[New-bugs-announce] [issue39476] Not convinced with the dynamic data type assignment

Sushma report at bugs.python.org
Tue Jan 28 07:01:38 EST 2020


New submission from Sushma <sush0907 at gmail.com>:

Hi 

Please find below example and the compiler error,

when i'm assigning value dynamically and when we comparing in "if" loop it is throwing compiler error. It should not throw error it should assign and act as int why it is thinking as string.
Code Snippet:
print("Hello World")

num = input("Enter number ")

print(num)

if(num%3 == 0):
    num+=num
    print(num)

Output in Console:
Hello World
Enter number 15
15
Traceback (most recent call last):
    File "main.py", line 15, in <module>
       if(num%3 == 0):
TypeError: not all arguments converted during string formatting

----------
messages: 360865
nosy: Sush0907
priority: normal
severity: normal
status: open
title: Not convinced with the dynamic data type assignment
type: compile error
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39476>
_______________________________________


More information about the New-bugs-announce mailing list