# 個別課題 船田 ## 1.問題解決の演習 https://paiza.jp/botchi/ 少なくとも以下の目標を達成します 1. レベル問Dの質問を完了します 2. レベルBとレベルCの質問を1つ完了します [エンジニアが死滅シタ世界 - 参考回答](https://hackmd.io/jwawj-asQ_yCHeMD3RnMEQ) [オンライン IDE](https://paiza.io/projects/JIGFcssADq8OOtQT5HIgdQ?language=python3) ### 使用できるテクニック * [値取得・出力サンプルコード](https://paiza.jp/guide/samplecode.html) ```python= # 公式例 input_line = int(input()) for i in range(input_line): s = input().rstrip().split(' ') print("hello = "+s[0]+" , world = "+s[1]) ``` ```python= # 私のアドバイス input_line = int(input()) for i in range(input_line): a, b = input().split() print("hello = " + a + " , world = " + b) ``` * [map関数](https://hackmd.io/Qkc91-u1T728S1DQWyAuFQ) * [eval関数](https://hackmd.io/gIP-59FYTRO84WpuiydNhw) ### 回答 終了したら、先生のようなhackmdを追加し、作成したコードを貼り付けて、以下のリンクを貼り付けてください。 これより下にリンクを貼り付けてください リンク: (https://hackmd.io/LRYtuW6IT36_1IW92ibmDA) ## 2.簡単なゲームを作る ```python= # -*- coding: utf-8 -*- """ Created on Sat Mar 27 18:01:03 2021 @author: usert """ """本来はこの中の部分も付けて、難易度設定可能にしたかったのですが 難しそうだったのでこのまま提出します。 確認は一通りしましたが、書かなくても良い所等あれば教えて頂ければ幸いです。 """ #ランダムの導入 import random #a = int(input("難易度を選んでください。 1 = easy 2 = normal 3 = hard")) #プレイヤーのHP php = int(100) #相手のHP ehp = int(100) #1=グー 2=チョキ 3 = パー """ if a == 1: int(ehp - 50) elif a == 3: int(ehp + 50) else: int(ehp) """ #どちらかが勝つまで続くループ while (php > 0 and ehp > 0): #手の選択 b = int(input("出す手を選んでください。 グー = 1 チョキ = 2 パー = 3")) #ランダムによる選択 c = random.randint(1,3) #ジャンケンに勝ったとき if (b == 1 and c == 2) or (b == 2 and c == 3) or (b == 3 and c == 1): ehp -=20 #ジャンケンに負けた時 elif (c == 1 and b == 2) or (c == 2 and b == 3) or (c == 3 and b == 1): php -=20 #それ以外 else: print("あいこ") print(php,ehp) #敗北の条件 if php < 0: print("You lose") #勝利の条件 else: print("You Win") ```