Hi there, I'm a real newbie to python so sorry if this is a stupid question or if I don't fully get your answer, no hate please!
I'm trying to write a small program to use when calculating differential equations bu using Euler's step method, don't worry if you don't know what that is, it's not important. My code looks like this:
#!/usr/bin/python3.3 -tt
import sys
def main():
x = float(input("Ange x - värde: "))
y = float(input("Ange y - värde: "))
print ("(",x,",",y,")")
h = float(input("Ange steglängd: "))
limit = float(input("Till vilket x - värde önskas gå: "))
while x < limit:
a = (2 * x) + y
y = (a * h) + y
x = x + h
print ("(",x,",",y,")")
main()
This works FINE, but what I'd really like to be able to to is for the user to be able to enter (via input) a function for the variable a, instead of me having to define it in the very code of the program. Is there a way of doing this?
Thanks for any help! (BTW the language in the code is Swedish)