Why when I put elif to make a simple calculator it tells me that elif is an invalid syntax? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why when I put elif to make a simple calculator it tells me that elif is an invalid syntax?

3rd Apr 2020, 1:23 PM
Martitxi_18
Martitxi_18 - avatar
9 Answers
+ 3
To be honest: This task is too high for you at the moment . If you do the first 4 lessons in python you will be able to do it.
3rd Apr 2020, 1:42 PM
nichdiomajadoch
+ 5
an if-elif-else block be like--- if condition: statement elif condition: statement elif (as many as you want): statement else: statement Put in mind that an if-elif block may not have any 'else' end. Some common error of that block is, 1.IndentaionError: misuse of spaces 2. SyntaxError: if you forget to add ':' after condition
5th Apr 2020, 11:20 AM
M Tamim
M Tamim - avatar
+ 3
Provide your code will help us to solve your problem.
3rd Apr 2020, 1:32 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 2
Martitxi you should use IF first then ELSE. And if more than 2 conditions then IF ELIF ELIF ELIF ELSE And use the TAB key to INDENT which means ......: ........... Space in the beginning of line when under a loop or If Else Conditions, functions or class. You have mentioned IF USER INPUT EQUALS TO "ADD". But u have to first take a input from user to decide whether its add or subtract.
3rd Apr 2020, 1:39 PM
maf
maf - avatar
+ 2
Thx
3rd Apr 2020, 1:48 PM
Martitxi_18
Martitxi_18 - avatar
3rd Apr 2020, 1:35 PM
Martitxi_18
Martitxi_18 - avatar
0
This is my code
3rd Apr 2020, 1:36 PM
Martitxi_18
Martitxi_18 - avatar
0
Please help me 😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭
3rd Apr 2020, 1:39 PM
Martitxi_18
Martitxi_18 - avatar
0
Yes, the truth is that I'm a little impatient and I really wanted to know how to make a calculator 😅😅😅😅😅😅😅😅😅😅😅😅
3rd Apr 2020, 1:58 PM
Martitxi_18
Martitxi_18 - avatar