スーパーで買い物したときの支払金額を計算する
以下の商品リストがあるとする。先頭の数字は商品番号。
- りんご 100円
- みかん 40円
- ぶどう 150円
- のり弁 350円
| [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) { |
| // ==UserScript== | |
| // @name Facebook cleaner | |
| // @namespace http://yattom.jp | |
| // @include https://www.facebook.com/ | |
| // @version 2 | |
| // @grant GM_addStyle | |
| // ==/UserScript== | |
| // 右側の、上から3番目のエリアに、People You May Knowや、広告が表示される。それを非表示にする。 | |
| var ego_section = document.getElementsByClassName("ego_section"); |
| 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個在庫している |
| # 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 |
| 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) { |