22nd Sep 2024, 2:43 PM
Muna Orah
Muna Orah - avatar
5 Answers
+ 2
Correct code: #fish tank volume problem. # main program def volume(a,b,c): return (a * b * c) / 1000 print(volume(10, 20, 30))
22nd Sep 2024, 3:06 PM
Luo Shenshi
Luo Shenshi - avatar
+ 2
Muna Orah 1. you don't need arguments, since the inputs are inside the function already. 2. you are multiplying strings. convert to int. 3. as Luo Shenshi said, you did not call the function. you only defined it. 4. you need to print the result in order to actually see it. def volume(): # no need for arguments # convert inputs to int a = int(input("enter the length of the fish tank: ")) print(a) b = int(input("enter the depth of the fish tank: ")) print(b) c = int(input("enter the height of the fish tank: ")) print(c) return (a * b * c) / 1000 v = volume() # call the function, assign to variable print(v) # print to see the result ''' sample Sololearn input: 2 4 6 submit '''
22nd Sep 2024, 4:26 PM
Bob_Li
Bob_Li - avatar
+ 1
Because you aren't calling the defined function volume
22nd Sep 2024, 3:02 PM
Luo Shenshi
Luo Shenshi - avatar
+ 1
Bob_Li no need to print volume if you can print v
22nd Sep 2024, 4:49 PM
Luo Shenshi
Luo Shenshi - avatar
+ 1
Luo Shenshi right...😁 I edited my reply because I was worried the function call part would be mixed up with the print result step. I did not remember to change the original print(volume()) part. Thanks for the reminder. 👍 I corrected my post above.
22nd Sep 2024, 4:56 PM
Bob_Li
Bob_Li - avatar