Can u help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can u help me?

well i am a new programmer. i was learning python. today i instaled python run time environment. then i started to write some code. now none of them actually worked. i will tell u 3 code.plz tell me what is wrong in my code. ............. 1st one: s=input( ) print(s+3) ......................... ok now 2nd one: c=3 s=input( ) print( s+c ) ........................... and now the final one. i mean 3rd one: c=3 s=input( ) i=(s+c) print(i) ................... well all of them showed eror. i used python 3.6.5 and idel. which actually i got with python run time environment file. so plz tell me where am i doing mistakes and what will be its solution. thank u. https://code.sololearn.com/cYfOHt0Pc4P0/?ref=app https://code.sololearn.com/cYfOHt0Pc4P0/?ref=app https://code.sololearn.com/cYfOHt0Pc4P0/?ref=app

24th May 2018, 10:25 PM
Afraim Ahmed
Afraim Ahmed - avatar
4 Answers
+ 3
Try s = int(input()) Input value is a string by default. You cannot add integer to a string.
24th May 2018, 10:42 PM
strawdog
strawdog - avatar
+ 5
Yes, you must declare that the input is an integer. So write s = int(input()) instead. Otherwise it will become a string, and not work right.
25th May 2018, 2:13 AM
Jax
Jax - avatar
+ 2
Seems like a bug in sololearn's interperter, maybe input is bugged, it should work.
24th May 2018, 11:41 PM
Skity
Skity - avatar
+ 1
thanks guys it worked.
25th May 2018, 3:23 AM
Afraim Ahmed
Afraim Ahmed - avatar