teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記

2020/09/04 06:46

投稿

jeanbiego
jeanbiego

スコア3966

answer CHANGED
@@ -1,4 +1,21 @@
1
1
  > 問題としては、時給10ドルで週40時間働いた場合、その週の売上を算出出来る
2
2
 
3
3
  hourに40, rateに10と入れて正しく400ドルの週給が出ているから正しいとは思いますが、そういう回答でいいんですか…?
4
+
5
+ 細かく言うなら、evalは使わなくても動くし、基本は使わないほうがいいです。それと、inputで得られた入力をfloatなりintなりにしといたほうがいいですね。
4
- あと、#Compute and display the total payのところが全角シャープになってます。
6
+ あと、#Compute and display the total payのところが全角シャープになってます。
7
+
8
+
9
+ ```python3
10
+ #To compute the weekly pay for a salesman
11
+
12
+ #Prompt the user for the hours worked and hourly rate
13
+
14
+ hours = float(input ("Enter Hours: "))
15
+ rate = float(input ("Enter Rate: "))
16
+
17
+ #Compute and display the total pay
18
+
19
+ pay = hours * rate
20
+ print ("Pay : ", pay)
21
+ ```