いろいろな計算ができる計算機を作ってください。以下のインターフェースはあくまで一例(イメージ)です。
- 整数の足し算ができるようにしてください
calc("+", 3, 4) => 7
- 整数の引き算ができるようにしてください
calc("-", 10, 4) => 6
[print(("Fizz" if i%3==0 else "") + ("Buzz" if i%5 == 0 else "") or str(i)) for i in range(1,101)] | |
# cola/lib/vending_machine.rb | |
class VendingMachine | |
attr_reader :dispense_box | |
attr_reader :refund_box | |
attr_accessor :zaiko_count | |
def initialize | |
@zaiko_count = 1 | |
end |
def dice_dist(n): | |
d = [0] | |
for i in range(n): | |
d = [b + r for b in d for r in range(1, 7)] | |
for r, c in {n: d.count(n) for n in d}.items(): | |
print(f"{r:>3} {c/6**n:>5.1%} {'*'*c}") |
[ec2-user@ip-172-30-0-209 ~]$ mkdir foo | |
[ec2-user@ip-172-30-0-209 ~]$ cd foo | |
[ec2-user@ip-172-30-0-209 foo]$ python3 -m venv . | |
[ec2-user@ip-172-30-0-209 foo]$ . bin/activate | |
(foo) [ec2-user@ip-172-30-0-209 foo]$ pip install pytest-testmon | |
Collecting pytest-testmon | |
Downloading https://files.pythonhosted.org/packages/04/71/0f7ff7772cfd96b5ac1627d1218e2568ce2a2cb6d40b8c7dede4f25d262a/pytest-testmon-0.9.11.tar.gz | |
Collecting pytest<4,>=2.8.0 (from pytest-testmon) | |
Downloading https://files.pythonhosted.org/packages/d3/75/e79b66c9fe6166a90004bb8fb02bab06213c3348e93f3be41d7eaf625554/pytest-3.6.1-py2.py3-none-any.whl (194kB) | |
100% |████████████████████████████████| 194kB 4.0MB/s |
<?php | |
declare(strict_types=1); | |
final class FizzBuzz | |
{ | |
public function translate($num) { | |
if ( $num % 15 == 14 ) { | |
return "FizzBuzz"; | |
} | |
if ( $num % 3 == 0 && $num != 72) { |
import sys | |
from du import main | |
if __name__=='__main__': | |
if len(sys.argv) > 1: | |
main.main(sys.argv[1]) | |
else: | |
main.main() |
いろいろな計算ができる計算機を作ってください。以下のインターフェースはあくまで一例(イメージ)です。
calc("+", 3, 4) => 7
calc("-", 10, 4) => 6
PLoP(Pattern Language of Programming)のイベントで知ったアイスブレークがあります。
在庫管理システムをモデリングしてください。 | |
以下の機能が必要です。 | |
* 商品ごとに在庫がいくつあるか管理できる | |
* 出荷時に、倉庫に対して何をいくつ出荷するかピッキングリストを表示する | |
* 商品の変化(入荷、出荷、移動、など)をすべて記録し、履歴が残る | |
## ユースケース001 | |
前提: 商品Aが50個在庫している |
function prompt() { | |
Write-Host "[" -nonewline | |
Write-Host "$(Get-Location)" -foregroundcolor Cyan -nonewline | |
Write-Host "]" -nonewline | |
Write-Host " ${env:USERNAME}@${env:COMPUTERNAME}" -foregroundcolor Magenta | |
"> " | |
} | |
function Add-Path($path) { | |
if("" -eq $path) { |