-1

how to take an algebraic expression as an input from the user? e.g x^2 + sin(x) e.g. sin(x) +cos(x) something like that and solve for some value of x In Java, we use buffered reader and expression input functions, but in python3.x what I have to use?

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153

1 Answers1

0

You can use the input() function in Python 3.

x = input()
print(x + " World")

>>> Hello
Hello World


x = input("Type a number: ")
print(int(x) * 2)

>>> Type a number: 5
10
theberzi
  • 2,142
  • 3
  • 20
  • 34