python 3.x - Calculation raises error "Can't multiply sequence by non-int of type 'float'" -
so, want write program python 3 can users calculate circumference of circle , sphere. far have.
pi = 3.14159 value = input("enter value of radius:") circ = 2*pi*value print(circ) but, keeps saying "can't multiply sequence non-int of type 'float'". how fix this? and, how make input numbers only? thank you.
try
value = float(input("enter value of radius: ")) note throw error if input isn't number.
also, while cant control input, keep asking number if type else this:
while true:     try:        value = float(input("enter value of radius: "))     except valueerror:        print("please enter number")
Comments
Post a Comment