回答編集履歴

1

追記

2020/09/04 06:46

投稿

jeanbiego
jeanbiego

スコア3966

test CHANGED
@@ -4,4 +4,38 @@
4
4
 
5
5
  hourに40, rateに10と入れて正しく400ドルの週給が出ているから正しいとは思いますが、そういう回答でいいんですか…?
6
6
 
7
+
8
+
9
+ 細かく言うなら、evalは使わなくても動くし、基本は使わないほうがいいです。それと、inputで得られた入力をfloatなりintなりにしといたほうがいいですね。
10
+
7
11
  あと、#Compute and display the total payのところが全角シャープになってます。
12
+
13
+
14
+
15
+
16
+
17
+ ```python3
18
+
19
+ #To compute the weekly pay for a salesman
20
+
21
+
22
+
23
+ #Prompt the user for the hours worked and hourly rate
24
+
25
+
26
+
27
+ hours = float(input ("Enter Hours: "))
28
+
29
+ rate = float(input ("Enter Rate: "))
30
+
31
+
32
+
33
+ #Compute and display the total pay
34
+
35
+
36
+
37
+ pay = hours * rate
38
+
39
+ print ("Pay : ", pay)
40
+
41
+ ```