- Ruby
- Python
- JavaScript
- CoffeeScript
- Haskell
- C#
- Java
- Clojure
- C++
- PHP
- Crystal
- F#
- C
- TypeScript
- Rust
- Swift
- Go
- R (Beta)
- Shell
- OCaml (Beta)
- Kotlin
- Fortran (Beta)
- Elixir
- Julia (Beta)
- Scala
- PowerShell (Beta)
- Nim (Beta)
- Reason (Beta)
- Racket
- Forth (Beta)
- Lua
- Pascal (Beta)
- Perl (Beta)
- Haxe (Beta)
- Elm (Beta)
- D (Beta)
- COBOL (Beta)
- Erlang (Beta)
- Prolog (Beta)
Start training on this collection. Each time you skip or complete a kata you will be taken to the next kata in the series. Once you cycle through the items in the collection you will revert back to your normal training routine.
DescriptionEdit
#############################################################
https://www.codewars.com/kata/tank-truck
import math
tankvol(h, d, vt)
def tankvol(h, d, vt):
output = 0
R = d / 2
height_cyllinder = vt / (math.pi * (R ** 2))
alpha_rad = 2 * math.acos((R - h) / R)
sector_area = (alpha_rad * (R ** 2)) / 2
triangle_base = math.sqrt(R ** 2 - ((R - h) ** 2))
p = ((R * 2 + triangle_base) / 2)
triangle_area = math.sqrt(p * (p - R) * (p - R) * (p - triangle_base))
output = (sector_area - triangle_area) * height_cyllinder
print(output)
return output
should return 1750
tankvol(h=60, d=120, vt=3500)
tankvol(60,120,3500) # should return 1750
tankvol(40,120,3500) # should return 1021
tankvol(80,120,3500) # should return 2478
https://planetcalc.ru/762/
#############################################################