1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【電脳少女プログラミング2088 ─壊レタ君を再構築─】Python初心者がやってみた(郊外のスラム街編)

Posted at

はじめに

前回の記事で「ネオン街の裏路地」をクリアして、今回は「郊外のスラム街」をクリアしたので書こうと思います。

難しくてまだクリアできてない方などに参考にしてもらえると嬉しいです。

【問題】

image.png
image.png

解答

今回もPython3を選択して書いてみました。

解答
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ!!
input_line = int(input()) # nを整数として受け取る

input_line = int((input_line / 2) + 100) # input_lineを2で割って、100足して、整数としてinputlineに代入

print(input_line) # input_lineを表示

コード解説

上のコードの解説をすると

値段を整数としてinput_lineに代入

4行目
input_line = int(input())

input_lineを2で割って100を足した数を整数としてinput_lineに代入

6行目
input_line = int((input_line / 2) + 100)

input_lineを表示

8行目
print(input_line)

こんな感じで上のコードで問題を解くことができました。

最後に

記事を最後までお読みいただきありがとうございます!
今回は結構簡単に解くことができました。次回は「データセンター」をやろうと思っています。次回も見てくださると嬉しいです。

ではまた他の記事で会いましょう!またねーヾ(´∀`)ノ

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?