Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # PowerShell Script to find all possible scenarios for Khris Davis hitting .247
- $avgString = $null
- $outcomes = $null
- $atbats = 1
- $hits = 1
- While ($atbats -lt 675) {
- $atbats = $atbats + 1
- # $hits = $hits + 1
- $avg = [math]::Round($hits / $atbats, 3)
- While ($avg -ne 0.247) {
- While ($avg -gt 0.247) {
- $atbats = $atbats + 1
- $avg = [math]::Round($hits / $atbats, 3)
- }
- While ($avg -lt 0.247) {
- $hits = $hits + 1
- $avg = [math]::Round($hits / $atbats, 3)
- }
- }
- $avgString = $avg.ToString().SubString($avg.ToString().length - 4, 4)
- $outcomes += "Average is $avgString with $hits hits in $atbats at bats.`r`n"
- }
- $outcomes | clip
- $outcomes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement