Message Boards Message Boards

Can I Use Wolframplha's step by step api in python?

Posted 7 months ago

I'm a beginner to python and i wanna do simple code that shows step by step output for user's mathematical problem's however i tried to use step by step api app key i can't get the step by step i just get answer as an output here's my code:

import requests

app_id = 'xxxxxx'

def query_wolfram_alpha(input_query):
    base_url = ''
    params = {
        'input': input_query,
        'format': 'plaintext',
        'output': 'JSON',
        'appid': app_id,

    response = requests.get(base_url, params=params)
    data = response.json()

    if 'pods' in data['queryresult']:

        result_pod = next((pod for pod in data['queryresult']['pods'] if pod['title'] == 'Result'), None)

        if result_pod:

            result_text = result_pod['subpods'][0]['plaintext']
            print(f"Solution: {result_text}")
            print("No solution found.")
        print("No solution found.")

query = 'expand (9x+3)^6'
POSTED BY: Aswin Selvam
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract