-1
"""A program to do FLAMES by accepting two names.
F-Friends, L-Lovers, A-Admirers, M-Married Couple, E-Enemies, S-Secret Lovers
Modified Version : Jan 11 2017
Programmer : Selikem v 0.1.0
"""
def Flames():
print("\nAre you READY FOR FLAMES????")
boyName = input("Enter the Guy's Name: ")
girlName = input("Enter the Lady's Name: ")
bName = list(boyName.lower()) #Splits name into individual characters and places it in a list
gName = list(girlName.lower())
#Below, We remove common letters found in both names.
for i in bName:
while i in gName:
bName.remove(i)
gName.remove(i)
break
for i in gName:
while i in bName:
bName.remove(i)
gName.remove(i)
break
#Below Checks whether there are common letters again and removes them.
while True:
for i in bName:
while i in gName:
bName.remove(i)
gName.remove(i)
break
for i in gName:
while i in bName:
bName.remove(i)
gName.remove(i)
break
flame = bName + gName #Variable to store remaining characters after cancellation of common ones.
#flame = set(flame)
#print(len(flame))
#print(bName)
#print(gName)
#print(flame)
while len(flame) < 50:
if len(flame) == 1 or len(flame) == 7 or len(flame) == 13 or len(flame) == 19 or len(flame) == 25:
FLAMES = "FRIENDS"
elif len(flame) == 2 or len(flame) == 8 or len(flame) == 14 or len(flame) == 20 or len(flame) == 26:
FLAMES = "LOVERS"
elif len(flame) == 3 or len(flame) == 9 or len(flame) == 15 or len(flame) == 21 or len(flame) == 27:
FLAMES = "ADMIRERS"
elif len(flame) == 4 or len(flame) == 10 or len(flame) == 16 or len(flame) == 22 or len(flame) == 28:
FLAMES = "MARRIED COUPLE"
elif len(flame) == 5 or len(flame) == 11 or len(flame) == 17 or len(flame) == 23 or len(flame) == 29:
FLAMES = "ENEMIES"
elif len(flame) == 6 or len(flame) == 12 or len(flame) == 18 or len(flame) == 24 or len(flame) == 30:
FLAMES = "SECRET ADMIRERS"
print("\n{} and {} are ".format(boyName, girlName) + FLAMES)
break
def Play_Again():
"""Function that permits user to play FLAMES again"""
while True:
print("\nDo you want to play again? :")
answer = input("(Enter y/n to continue): ")
if answer == 'y' :
Flames()
else:
print("\nTHANK YOU FOR PLAYING!")
break
Flames()
Play_Again()
爲如:我知道,維克多和維多利亞會導致戀人,通過手動執行計算。我如何爲此編寫單元測試? –
爲如:我知道,維克多和維多利亞會導致戀人,通過手動執行計算。我如何爲此編寫單元測試? –
你應該分開這需要用戶輸入和實際功能的功能。然後,你可以寫這個函數傳遞任何值,你喜歡的一個單元測試。 –