0
這是我的代碼(其中IDLE亮點「打印」,並說「無效語法」:爲什麼會出現語法錯誤?
import random
initial_val = 10
attributes = str("Character 1's Strength: ",(random.randint(1,12)/random.randint(1,4) + initial_val), \
"\nCharacter 1's Skill: ",(random.randint(1,12)/random.randint(1,4) + initial_val), \
"\n\nCharacter 2's Strength: ",(random.randint(1,12)/random.randint(1,4) + initial_val), \
"\nCharacter 2's Skill: ",(random.randint(1,12)/random.randint(1,4) + initial_val)
print(attributes)
file = open("Attribute.txt", "w")
file.write(attributes)
file.close()
input("\n\nPress enter to exit")
它爲什麼這樣做很可能是非常明顯的,但我是新來的編程 非常感謝。