Last Updated : 12 Jul, 2025
The
Wolfram|Alpha Webservice API
provides a web-based API allowing the computational and presentation capabilities of Wolfram|Alpha to be integrated into web, mobile, desktop, and enterprise applications.
Wolfram Alpha
is an API which can compute expert-level answers using Wolfram’s algorithms, knowledgebase and AI technology. It is made possible by the Wolfram Language. This article tells how to create a simple assistant application in Python which can answer simple questions like the ones listed below.
Input : What is the capital of India? Output : New Delhi Input : What is sin(30)? Output : 0.5Prerequisite:
Basic understanding of
pythonsyntax and functions.
Getting API IdMake sure that
wolframalpha
python package is installed beforehand. It can be done by running the following command in the terminal or cmd -
pip install wolframalpha
Below is the implementation
Python3 1==
# Python program to
# demonstrate creation of an
# assistant using wolf ram API
import wolframalpha
# Taking input from user
question = input('Question: ')
# App id obtained by the above steps
app_id = ‘Your app_id’
# Instance of wolf ram alpha
# client class
client = wolframalpha.Client(app_id)
# Stores the response from
# wolf ram alpha
res = client.query(question)
# Includes only text from the response
answer = next(res.results).text
print(answer)
Output:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4