0
import math
var = input("Give some numbers!")
print(math.sinh(var))

It doesn't give me an answer if I put something in? Can someone help me?

phuclv
  • 37,963
  • 15
  • 156
  • 475
PythonGuy
  • 1
  • 2
  • I have used import math! – PythonGuy Jun 28 '21 at 14:35
  • `input` returns a string, and `math.sinh` requires a float, so you need to convert the string response into a float as Manby suggests. You could convert it to an `int` as kingpanda419 suggested, but this will artificially restrict the values you can provide to integers only. – andand Jun 28 '21 at 16:26
  • Does this answer your question? [How can I read inputs as numbers?](https://stackoverflow.com/questions/20449427/how-can-i-read-inputs-as-numbers) – Stef Jun 28 '21 at 16:36

2 Answers2

1

You need to convert the input into a float after it is received.

In python, by default, inputs are recieved as strings. math.sinh will only take numerical inputs (int and float types), therefore you need to convert the input to a float before storing it in var.

Try:

import math
var = float(input("Give some numbers!"))
print(math.sinh(var))
Manby
  • 429
  • 2
  • 12
0

I think your inputing value type is NAN. so i suggest that var=int(input("Give some numbers!"))

kingpanda419
  • 121
  • 2