Daily Coding Challenge - Equation Validation

Tell us what’s happening:

How do I prevent ModuleNotFoundError, and import mathparse? Or is there another way to solve this problem without having to create my own parser? Thank you.

Your code so far


from mathparse import mathparse

def is_valid_equation(equation):

    sum = equation.split(" = ")[0]
    answer = int(equation.split(" = ")[1])
    print(sum, answer)
    
    sum = mathparse.parse(sum)
    

    return sum == answer

is_valid_equation("2 + 9 / 3 = 5")

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36

Challenge Information:

Daily Coding Challenge - Equation Validation

https://www.freecodecamp.org/learn/daily-coding-challenge/2026-04-04

GitHub Link: https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/daily-coding-challenge/69b559d2903b9e4afe9075f7.md

Welcome to the forum @alistairedward

You can solve this challenge without importing any modules.

Happy coding

you can’t, the environment does not gace that module available