所以我正在寫一個比賽的遊戲。麻煩在Python中分割和分割
直到此時,用戶輸入了一個數字。
if user % 2 == 0 :
print("What you entered is an even number.")
print("")
print("So, according to RULE 1, we must now divide it by 2.")
int(user)/ 2
thing2 = "So, now we're left with " + str(user) + "."
print (thing2)
else :
print("What you entered is an odd number.")
print("")
print("So, according to RULE 1, we must now multiply it by 3, and add 1.")
int(user) * 3
user += 1
thing2 = "So, now we're left with " + str(user) + "."
print (thing2)
....但int(user) * 3
部分實際上並不乘以3號,但它確實增加了一個。
爲了記錄,我嘗試了很多可能性,例如只有user * 3
(沒有int()的東西),我是Python的初學者。
謝謝,對不起,這是一個愚蠢的錯誤。 – gingepusscat123