0

What am I doing wrong?

I am trying to make a calculator on python, and if I use the '+' symbol, everything executes perfectly. If I dont, it comes up with the error shown below, although according to my code it should say "Try again." Error: Traceback (most recent call last): File "...\Playground\", line 4, in <module> if a.index ("+") ValueError: substring not found https://code.sololearn.com/c0yoGqbZ5fKx/?ref=app

10th Apr 2018, 2:31 PM
Robyn
3 Antworten
+ 2
use this condition if "+" in a:
10th Apr 2018, 2:45 PM
michal
+ 2
From the documentation on str() .index() method. str.index(sub[, start[, end]])¶ Like find(), but raise ValueError when the substring is not found. It will raise a ValueError when the substring isn't found. You need to handle this.
10th Apr 2018, 2:46 PM
ChaoticDawg
ChaoticDawg - avatar
0
сам такой
10th Apr 2018, 2:36 PM
Егор