[題目來源:Dept. of Business Administration, NCKU]
Task DescriptionFour potential criminals were suspected to be the thief, and detained by polices. Their IDs are 1, 2, 3 and 4. It is sure that one of them is the true criminal. During the questioning and interrogation, each of them provides one sentence, as listed below.
1 said he is not the thief.
2 said 3 is the thief.
3 said 4 is the thief.
4 said 3 is a liar.
Evidences tell the police that three of these four sentences are true, and one is false. Please complete the following code in order to judge who is the true thief. Your task is to use Boolean operators (and, or, not) and relational operators (==, !=) with some expressions to find the true thief.
Hint: 試著使用 while 迴圈嘗試判斷每個人是小偷的情況,並使用 if 判斷有幾個人是說真話
12345 thief
=
1
while
thief <
=
4
:
if
[Please write down the complete code]:
print
(
'The thief is'
, thief)
thief
=
thief
+
1
Note that you are not necessary to follow the above code if you have a different idea about how to solve this problem.
Output Format
印出誰是thief
The thief is [thief number]
Sample Output
The thief is 3