+ 4

Please can someone a code for a numerical operation for me? I tried but it keeps giving errors.

2+2 how do I perform this operation with python

31st May 2018, 2:19 PM
Larie
Larie - avatar
10 ответов
+ 4
Do you just mean to output it? cos you can just do print(2+2)
4th Jun 2018, 1:23 AM
KeDee
KeDee - avatar
+ 4
I think this might help : num1 = input(2) num2 = input(2) sum = float(2) + float(2) print('The sum of {0} and {1} is {2}.format(num1,num2,sum)) I found this stuff on the internet. Actually I don't know Python, and I am good at JS, but I believe that this stuff will help you. Just try it, and if there is any error, contact me.👍 PS : If it works, please leave an upvote and if you like the answer, please mark it as the best answer. Thanks!
31st May 2018, 2:47 PM
Rahul Hemdev
Rahul Hemdev - avatar
+ 4
thanks
31st May 2018, 2:50 PM
Larie
Larie - avatar
+ 4
Welcome! Glad to help.
1st Jun 2018, 5:46 AM
Rahul Hemdev
Rahul Hemdev - avatar
+ 2
I've learnt that already, thank u.
4th Jun 2018, 8:58 AM
Larie
Larie - avatar
+ 1
a = int(input ("Enter a value: ")) b = int(input("Enter b value: ")) c = a + b print("Result is : ", c) Here we need to convert the input to int because by default every input in python will be considered as String.
22nd Aug 2018, 1:42 AM
naveen kumar
naveen kumar - avatar
0
Sorry, Could you please elaborate your question?
31st May 2018, 2:24 PM
Sachin Artani
Sachin Artani - avatar
0
post your work, that way someone can try and help.
31st May 2018, 2:24 PM
Mpho Mphego
Mpho Mphego - avatar
0
num1=input('enter num1') num2=input('enter num2') add=num1+num2 print add
21st Aug 2018, 4:48 PM
Shantanu Pabitwar
Shantanu Pabitwar - avatar
0
num1=int(input('Enter the num1)) num2=int(input('Enter the num2)) a=num1+num2 print('a=',a)
21st Aug 2018, 5:16 PM
Rahul Vishwakarma
Rahul Vishwakarma - avatar