why can I convert string to integer and then add it to integer❓❓ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why can I convert string to integer and then add it to integer❓❓

Python

10th Jul 2020, 8:18 AM
Zevil Evil
Zevil Evil - avatar
4 Answers
+ 3
Zevil Evil why don't you try these things on code playground instead of asking it here.
10th Jul 2020, 8:54 AM
Arsenic
Arsenic - avatar
+ 2
You can do it using int() function.
10th Jul 2020, 8:21 AM
Arsenic
Arsenic - avatar
+ 1
Arsenic What about this:- print(2 + int("sam)) or print(2+int(sam)). Will it work? 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 And what is ord function?
10th Jul 2020, 8:48 AM
Zevil Evil
Zevil Evil - avatar
+ 1
Arsenic I tried mahn. It didn't work. That's why I was asking? Have I done something wrong or do I need to follow a different concept? btw, thank for the reply!
10th Jul 2020, 9:01 AM
Zevil Evil
Zevil Evil - avatar