+ 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
10 ответов
+ 4
Do you just mean to output it?
cos you can just do
print(2+2)
+ 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!
+ 4
thanks
+ 4
Welcome! Glad to help.
+ 2
I've learnt that already, thank u.
+ 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.
0
Sorry,
Could you please elaborate your question?
0
post your work, that way someone can try and help.
0
num1=input('enter num1')
num2=input('enter num2')
add=num1+num2
print add
0
num1=int(input('Enter the num1))
num2=int(input('Enter the num2))
a=num1+num2
print('a=',a)