9 Answers
New AnswerWrite a program to take two integers as input and output their sum. Sample Input: 2 8 Sample Output: 10 This? Take two inputs (as integers) And use '+' for adding them And finally use 'print' to output the sum
Titi_2402 for taking input we use input and if you want to take input as integer then you have to write like this: x=int(input()) (for integers) And if you write x=input() (for strings) It will be for to take input as strings. And there is one more... x=float(input()) This if for taking decimals like 3.4873 or 3.72 and if you will input a integer as input in float(input()) and will print it like: print(x)... ...it will be like x.0 for example you will give 4 as input it will print 4.0 (as float).
Have a read: https://www.w3schools.com/python/python_strings.asp https://www.programiz.com/python-programming/string
Hi Rishi, I am NEZ (as you can see after opening my profile), i am invisible cuz of some reasons but will be changing my name to 'NEZ' again soon...😁
Oh yeah OK. Thanks you. Mmmh I just a a problem because I don't understand the difference between int() and input() and what does this things mean. And string also. I know it's in the first lessons but I don't know why I don't understand 😅
Ohh! How lucky to have people like you who gladly respond to messages👍🔥😁. Thank you very much ! And just also have an other question. Strings mean this things " or it means an other thing that I don't understand 😅?
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message