Dear Tutor,

In earlier days I programmed a lot with Quick Basic in DOS.
Now I retiered, I hoped to have Python as a platform.
So I installed it and saw a lot of simmularity with Basic.

I hope you can help me with the following, which should not be difficult,
but I cannot find the solution.

When I type this:

>>> a=2
>>> d=a+4
>>> print(d)
6

I got the correct answer.

When I try this to run it in a Module:

a=input('-->' )
print(a)
d=a+4
print(d)

I get this as a result:


input test.py
-->2
2
Traceback (most recent call last):
  File
"C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\Lib\idlelib\input
test.py", line 3, in <module>
    d=a+4
TypeError: must be str, not int
>>>

I receive this message.

I tried to use float(), but nothing works.
What am I doing wrong ?

Thanks in advance !
Regards,
Wim Berrelkamp
Groningen, The Netherlands
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to