Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Help

Im trying to make a basic calculator i tried this Num1 = input ("Enter A Number") Num2 = input ("Enter Another Number") Result = float(Num1) + float(Num2) Print(Result) but it did not work i went on youtube and tried to get help but no 😢

14th May 2020, 4:50 PM
Hal0Pr012
Hal0Pr012 - avatar
25 Answers
+ 8
Here you did mistake on the print statement, write In small letters because python is case sensitive Try this one👍 Num1 = input ("Enter A Number") Num2 = input ("Enter Another Number") Result = float(Num1) + float(Num2) print(Result) Happy coding :-)
16th May 2020, 11:25 AM
vikas vareya
vikas vareya - avatar
+ 6
Enter the input [numbers] in separate lines otherwise use split() keyword. For example, Help Num1, Num2 = input("Enter 2 numbers with space between them:).split() #using split() it separates the input and make it as list which you can use it for multiple assignment Result = float(Num1) + float(Num2) #now you can use data types for further math operation. print(Result) """ Output: Enter 2 number with space between them: 5 6 11.0 """
16th May 2020, 1:18 AM
Jenson Y
+ 6
Make the 'P' of 'print fucntion to lowercase Python is case sensitive bro😊
16th May 2020, 1:49 AM
Habeeb Rahman K T
Habeeb Rahman K T - avatar
+ 4
Code Crasher that's why I have explained so that he/she may improve little extra. And also they will be eager to know what it means.
16th May 2020, 2:30 AM
Jenson Y
+ 4
Hal0Pr012 and also remember that python is a case sensitive language and all keyword(print,input,def,if,else,...) in python are in in lower case
17th May 2020, 6:06 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 3
Hal0Pr012 Make sure that "P" in the "Print" is lower case i.e., "print(Result)"
14th May 2020, 4:55 PM
Kiran Deep Naidu
Kiran Deep Naidu - avatar
+ 3
you can use eval(num1,num2)
14th May 2020, 5:43 PM
💡Arno Gevorgyan 🐍
💡Arno Gevorgyan 🐍 - avatar
+ 3
Lay_in_life It was a well explained response. 👌 While the OP may not fully grasp it until later, others can still benefit from learning an alternative to the separate inputs per line.
16th May 2020, 3:37 AM
David Carroll
David Carroll - avatar
+ 3
Write print not Print
16th May 2020, 12:41 PM
Hiba Y.S.M
Hiba Y.S.M - avatar
+ 3
I'd suggest you to post actual picture of code here. This seems to be right and it should be working.
16th May 2020, 12:41 PM
Prashant Vikram
Prashant Vikram - avatar
+ 2
Give the two numbers separated with a line...
14th May 2020, 5:06 PM
Kiran Deep Naidu
Kiran Deep Naidu - avatar
+ 2
Hal0Pr012 You can also make the value int/float at the time of input, i.e. float(input())
16th May 2020, 3:42 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 2
boualleg yasmine, vinita sarda I would use float instead of integer with the input Like AKSHAY said Hal0Pr012 keep trying
16th May 2020, 4:26 PM
W-tto
+ 1
It says i need input,im a beginner so i dont know what to do.
14th May 2020, 4:58 PM
Hal0Pr012
Hal0Pr012 - avatar
+ 1
Num1 = input ("Enter A Number") Num2 = input ("Enter Another Number") Result = float(Num1) + float(Num2) Print(Result)
14th May 2020, 4:59 PM
Hal0Pr012
Hal0Pr012 - avatar
+ 1
It says i need an input and to split lines.idk how to do that
14th May 2020, 5:05 PM
Hal0Pr012
Hal0Pr012 - avatar
+ 1
Im a beginner i dont know how to do that
14th May 2020, 5:07 PM
Hal0Pr012
Hal0Pr012 - avatar
+ 1
Hal0Pr012 Just enter first number, press enter, enter another number, again enter to view result
14th May 2020, 5:12 PM
Sanjyot21
Sanjyot21 - avatar
+ 1
input returns a string,you can use eval() to convert a string to a number,then you can add numbers and get what you want.
15th May 2020, 1:01 AM
浩天 刘
+ 1
num1= int(input(bla bal bla)) num2=int(input(bla bla bla)) #u gotta put int before input bcz input takes a string and u wanna use integer
15th May 2020, 9:30 AM
boualleg yasmine
boualleg yasmine - avatar