+ 2

In this python code I only want one input not two

pi=3.14 radius,side=input().split() radius=float(radius ) side =float(side) area_c=pi*radius*radius area_s=side*side print ("\n Area of circle: %2f"%area_c) print("Area of square: %2f"%area_s)

8th Sep 2020, 6:07 PM
Sourabh Tewatia
6 Respostas
+ 4
Input: 2.5 10.25 radius,side = *list(map(lambda x: float(x), input().split())) print(radius, side) print(3.14*radius*radius) print(side**2) Output: 2.5 10.25 19.625 105.0625
8th Sep 2020, 6:59 PM
Namit Jain
Namit Jain - avatar
+ 3
If I am understanding you correctly, you do not want: radius,side=input().split() If this is the case you will need to hard code one of those values: radius=2 side=input() OR radius=input() side=2
8th Sep 2020, 6:14 PM
Steven M
Steven M - avatar
+ 2
Change your code like this↓ pi=3.14 radius=side=input().split() radius=float(radius[0]) side =float(side[0]) area_c=pi*radius*radius area_s=side*side print ("\n Area of circle: %2f"%area_c) print("Area of square: %2f"%area_s) in your code you must give two inputs. because radius,side=input().split() means, radius=input().split() and side is not get any value.So this code shows value error.
8th Sep 2020, 6:18 PM
˜”*°‱.˜”*°‱ Mohan 333 ‱°*”˜.‱°*”˜
˜”*°‱.˜”*°‱ Mohan 333 ‱°*”˜.‱°*”˜ - avatar
+ 2
Bro now also didn't getting answer
8th Sep 2020, 6:28 PM
Sourabh Tewatia
+ 2
Mohan 333 thats not true, his code is taking 2 inputs separated by a white space. So an input of: 2 4 Would set radius=2 side=4
8th Sep 2020, 6:33 PM
Steven M
Steven M - avatar
+ 1
9th Sep 2020, 4:27 AM
˜”*°‱.˜”*°‱ Mohan 333 ‱°*”˜.‱°*”˜
˜”*°‱.˜”*°‱ Mohan 333 ‱°*”˜.‱°*”˜ - avatar