hi,
right now i'm working on a program that prints parabolic shapes on the screen.
And i want to be able to type a formule, and than i need python to understand that formule :?
I have heard from many people that this is extremely hard
But is there a way to do this?
I already made a peice of the program, it asks for the lenght of the formule, and then it asks piece by piece what characters the formule contains, and then it puts these characters in a list. But now the problem is how do i use the list as something that python can calculate :confused:
I would like it very much if someone could help me.
tzho11 0 Newbie Poster
Recommended Answers
Jump to PostThe formula has to follow Python syntax. For example ...
from math import * # if the formula is y = 2.5sin(3x) - cos(2x) # the user has to input a string like "2.5*sin(3*x) - cos(2*x)" # so Python can evaluate it correctly input_str = "2.5*sin(3*x) - …
Jump to Postthat script you showed, is a nice script,
but i want to be able to type in a formule, and then it calculates that, not a standard formuleIn that case you have to write a parser that converts the user's formula into something Python can calculate. Still, the user …
All 8 Replies
jcao219 18 Posting Pro in Training
tzho11 0 Newbie Poster
jcao219 18 Posting Pro in Training
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
tzho11 0 Newbie Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
pelin -6 Junior Poster in Training
JoshuaBurleson 23 Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.