Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 8 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
37 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
108 lignes
Copier tout
98 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
140 lignes
Copier tout
choice=raw_input("What type of quiz do you want to do: maths or science? ")
choice=raw_input("What type of quiz do you want to do: maths or science? ")
topic=open("topic.txt", "a+")
topic=open("topic.txt", "a+")
topic.write(choice + '\n')
topic.write(choice + '\n')
topic.close()
topic.close()
difficulty=raw_input("What difficulty do you want to play on: easy, medium or hard? ")
difficulty=raw_input("What difficulty do you want to play on: easy, medium or hard? ")
diff=open("difficulty.txt", "a+")
diff=open("difficulty.txt", "a+")
diff.write(difficulty + '\n')
diff.write(difficulty + '\n')
diff.close()
diff.close()
score = 0
score = 0
Copier
Copié
Copier
Copié
def
answercheck(score,
str
_answer,
int
_answer):
user_answer=raw_input("Select your answer. ")
def
str_
answercheck(score,
user
_answer,
str
_answer):
if user_answer.upper()
== str(
str_answer
) or user_answer.upper() == str(int_answer)
:
if user_answer.upper()
==
str_answer
:
print("Well done
, that's correct
")
print("Well done
")
score+=1
score+=1
Copier
Copié
Copier
Copié
print
("Your score is " +str(score))
else:
print
("Wrong, it was "+str_answer)
raw_input("Press enter to continue")
return score
def int_answercheck(score, user_answer, int_answer):
if int(user_answer.upper())==int_answer:
print("Well done")
score+=1
else:
else:
print ("Wrong, it was "+str(int_answer))
print ("Wrong, it was "+str(int_answer))
Copier
Copié
Copier
Copié
print("Your score is " +str(score))
raw_input("Press enter to continue")
raw_input("Press enter to continue")
return score
return score
Copier
Copié
Copier
Copié
def report(score):
print("Your final score is "+str(score))
per=str(score)*(100/5)
print("You achieved "+per+"%")
if score==5:
print("You achieved an A*")
elif score==4:
print("You acieved a grade B")
elif score==3:
print("You achieved a grade C")
elif score==2:
print("You achieved a grade D")
elif score<=1:
print("You failed")
if choice.lower() == "maths" and difficulty.lower() == "easy":
if choice.lower() == "maths" and difficulty.lower() == "easy":
easym=open("mathseasy.txt" , "r")
easym=open("mathseasy.txt" , "r")
lines = easym.readlines()
lines = easym.readlines()
print lines[0]
print lines[0]
print lines[1]
print lines[1]
print("A. 4"+'\n'+"B. 6")
print("A. 4"+'\n'+"B. 6")
str_answer_one="A"
str_answer_one="A"
int_answer_one=4
int_answer_one=4
Copier
Copié
Copier
Copié
first_score=
answercheck(score,
str
_answer_one, int_answer_one)
user_answer_one=raw_input("Select your answer. ")
if user_answer_one.isdigit()==True:
first_score=
int_
answercheck(score,
user
_answer_one, int_answer_one)
else:
first_score=str_answercheck(score, user_answer_one, str_answer_one)
print lines[2]
print lines[2]
print("A. 5"+'\n'+"B. 6")
print("A. 5"+'\n'+"B. 6")
str_answer_two="A"
str_answer_two="A"
int_answer_two=5
int_answer_two=5
Copier
Copié
Copier
Copié
second_score=
answercheck(first_score,
str
_answer_two, int_answer_two)
user_answer_two=raw_input("Select your answer. ")
if user_answer_two.isdigit()==True:
second_score=
int_
answercheck(first_score,
user
_answer_two, int_answer_two)
else:
second_score=str_answercheck(first_score, user_answer_two, str_answer_two)
print lines[3]
print lines[3]
print("A. 15"+'\n'+"B. 20")
print("A. 15"+'\n'+"B. 20")
str_answer_three="B"
str_answer_three="B"
int_answer_three=20
int_answer_three=20
Copier
Copié
Copier
Copié
third_score=
answercheck(second_score,
str
_answer_three, int_answer_three)
user_answer_three=raw_input("Select your answer. ")
if user_answer_three.isdigit()==True:
third_score=
int_
answercheck(second_score,
user
_answer_three, int_answer_three)
else:
third_score=str_answercheck(second_score, user_answer_three, str_answer_three)
print lines[4]
print lines[4]
print("A. 13"+'\n'+"B. 15")
print("A. 13"+'\n'+"B. 15")
str_answer_four="A"
str_answer_four="A"
int_answer_four=13
int_answer_four=13
Copier
Copié
Copier
Copié
fourth_score=
answercheck(third_score,
str
_answer_four, int_answer_four)
user_answer_four=raw_input("Select your answer. ")
if user_answer_four.isdigit()==True:
fourth_score=
int_
answercheck(third_score,
user
_answer_four, int_answer_four)
else:
fourth_score=str_answercheck(third_score, user_answer_four, str_answer_four)
print lines[5]
print lines[5]
print("A. 100"+'\n'+"B. 110")
print("A. 100"+'\n'+"B. 110")
str_answer_five="B"
str_answer_five="B"
int_answer_five=110
int_answer_five=110
Copier
Copié
Copier
Copié
fifth_score=
answercheck(fourth_score,
str
_answer_five, int_answer_five)
user_answer_five=raw_input("Select your answer. ")
report(
fifth_score
)
if user_answer_five.isdigit()==True:
fifth_score=
int_
answercheck(fourth_score,
user
_answer_five, int_answer_five)
else:
fifth_score
=str_answercheck(fourth_score, user_answer_five, str_answer_five)
if choice.lower() == "maths" and difficulty.lower() == "medium":
if choice.lower() == "maths" and difficulty.lower() == "medium":
mediumm=open("mathsmedium.txt" , "r")
mediumm=open("mathsmedium.txt" , "r")
lines = mediumm.readlines()
lines = mediumm.readlines()
print lines[0]
print lines[0]
print lines[1]
print lines[1]
print("A. 30"+'\n'+"B. 35")
print("A. 30"+'\n'+"B. 35")
str_answer_one="A"
str_answer_one="A"
int_answer_one=30
int_answer_one=30
Copier
Copié
Copier
Copié
first_score=
answercheck(score,
str
_answer_one, int_answer_one)
user_answer_one=raw_input("Select your answer. ")
if user_answer_one.isdigit()==True:
first_score=
int_
answercheck(score,
user
_answer_one, int_answer_one)
else:
first_score=str_answercheck(score, user_answer_one, str_answer_one)
print lines[2]
print lines[2]
print("A. 100"+'\n'+"B. 110")
print("A. 100"+'\n'+"B. 110")
str_answer_two="B"
str_answer_two="B"
int_answer_two=110
int_answer_two=110
Copier
Copié
Copier
Copié
second_score=
answercheck(first_score,
str
_answer_two, int_answer_two)
user_answer_two=raw_input("Select your answer. ")
if user_answer_two.isdigit()==True:
second_score=
int_
answercheck(first_score,
user
_answer_two, int_answer_two)
else:
second_score=str_answercheck(first_score, user_answer_two, str_answer_two)
print lines[3]
print lines[3]
print("A. 13"+'\n'+"B. 15")
print("A. 13"+'\n'+"B. 15")
str_answer_three="A"
str_answer_three="A"
int_answer_three=13
int_answer_three=13
Copier
Copié
Copier
Copié
third_score=
answercheck(second_score,
str
_answer_three, int_answer_three)
user_answer_three=raw_input("Select your answer. ")
if user_answer_three.isdigit()==True:
third_score=
int_
answercheck(second_score,
user
_answer_three, int_answer_three)
else:
third_score=str_answercheck(second_score, user_answer_three, str_answer_three)
print lines[4]
print lines[4]
print("A. 30"+'\n'+"B. 32")
print("A. 30"+'\n'+"B. 32")
str_answer_four="B"
str_answer_four="B"
int_answer_four=32
int_answer_four=32
Copier
Copié
Copier
Copié
fourth_score=
answercheck(third_score,
str
_answer_four, int_answer_four)
user_answer_four=raw_input("Select your answer. ")
if user_answer_four.isdigit()==True:
fourth_score=
int_
answercheck(third_score,
user
_answer_four, int_answer_four)
else:
fourth_score=str_answercheck(third_score, user_answer_four, str_answer_four)
print lines[5]
print lines[5]
print("A. 21"+'\n'+"B. 29")
print("A. 21"+'\n'+"B. 29")
str_answer_five="B"
str_answer_five="B"
int_answer_five=29
int_answer_five=29
Copier
Copié
Copier
Copié
fifth_score=
answercheck(fourth_score,
str
_answer_five, int_answer_five)
user_answer_five=raw_input("Select your answer. ")
report(
fifth_score
)
if user_answer_five.isdigit()==True:
fifth_score=
int_
answercheck(fourth_score,
user
_answer_five, int_answer_five)
else:
fifth_score
=str_answercheck(fourth_score, user_answer_five, str_answer_five
)
Différences enregistrées
Texte d'origine
Ouvrir un fichier
choice=raw_input("What type of quiz do you want to do: maths or science? ") topic=open("topic.txt", "a+") topic.write(choice + '\n') topic.close() difficulty=raw_input("What difficulty do you want to play on: easy, medium or hard? ") diff=open("difficulty.txt", "a+") diff.write(difficulty + '\n') diff.close() score = 0 def answercheck(score, str_answer, int_answer): user_answer=raw_input("Select your answer. ") if user_answer.upper() == str(str_answer) or user_answer.upper() == str(int_answer): print("Well done, that's correct") score+=1 print("Your score is " +str(score)) else: print ("Wrong, it was "+str(int_answer)) print("Your score is " +str(score)) raw_input("Press enter to continue") return score def report(score): print("Your final score is "+str(score)) per=str(score)*(100/5) print("You achieved "+per+"%") if score==5: print("You achieved an A*") elif score==4: print("You acieved a grade B") elif score==3: print("You achieved a grade C") elif score==2: print("You achieved a grade D") elif score<=1: print("You failed") if choice.lower() == "maths" and difficulty.lower() == "easy": easym=open("mathseasy.txt" , "r") lines = easym.readlines() print lines[0] print lines[1] print("A. 4"+'\n'+"B. 6") str_answer_one="A" int_answer_one=4 first_score=answercheck(score, str_answer_one, int_answer_one) print lines[2] print("A. 5"+'\n'+"B. 6") str_answer_two="A" int_answer_two=5 second_score=answercheck(first_score, str_answer_two, int_answer_two) print lines[3] print("A. 15"+'\n'+"B. 20") str_answer_three="B" int_answer_three=20 third_score=answercheck(second_score, str_answer_three, int_answer_three) print lines[4] print("A. 13"+'\n'+"B. 15") str_answer_four="A" int_answer_four=13 fourth_score=answercheck(third_score, str_answer_four, int_answer_four) print lines[5] print("A. 100"+'\n'+"B. 110") str_answer_five="B" int_answer_five=110 fifth_score=answercheck(fourth_score, str_answer_five, int_answer_five) report(fifth_score) if choice.lower() == "maths" and difficulty.lower() == "medium": mediumm=open("mathsmedium.txt" , "r") lines = mediumm.readlines() print lines[0] print lines[1] print("A. 30"+'\n'+"B. 35") str_answer_one="A" int_answer_one=30 first_score=answercheck(score, str_answer_one, int_answer_one) print lines[2] print("A. 100"+'\n'+"B. 110") str_answer_two="B" int_answer_two=110 second_score=answercheck(first_score, str_answer_two, int_answer_two) print lines[3] print("A. 13"+'\n'+"B. 15") str_answer_three="A" int_answer_three=13 third_score=answercheck(second_score, str_answer_three, int_answer_three) print lines[4] print("A. 30"+'\n'+"B. 32") str_answer_four="B" int_answer_four=32 fourth_score=answercheck(third_score, str_answer_four, int_answer_four) print lines[5] print("A. 21"+'\n'+"B. 29") str_answer_five="B" int_answer_five=29 fifth_score=answercheck(fourth_score, str_answer_five, int_answer_five) report(fifth_score)
Texte modifié
Ouvrir un fichier
choice=raw_input("What type of quiz do you want to do: maths or science? ") topic=open("topic.txt", "a+") topic.write(choice + '\n') topic.close() difficulty=raw_input("What difficulty do you want to play on: easy, medium or hard? ") diff=open("difficulty.txt", "a+") diff.write(difficulty + '\n') diff.close() score = 0 def str_answercheck(score, user_answer, str_answer): if user_answer.upper()==str_answer: print("Well done") score+=1 else: print ("Wrong, it was "+str_answer) raw_input("Press enter to continue") return score def int_answercheck(score, user_answer, int_answer): if int(user_answer.upper())==int_answer: print("Well done") score+=1 else: print ("Wrong, it was "+str(int_answer)) raw_input("Press enter to continue") return score if choice.lower() == "maths" and difficulty.lower() == "easy": easym=open("mathseasy.txt" , "r") lines = easym.readlines() print lines[0] print lines[1] print("A. 4"+'\n'+"B. 6") str_answer_one="A" int_answer_one=4 user_answer_one=raw_input("Select your answer. ") if user_answer_one.isdigit()==True: first_score=int_answercheck(score, user_answer_one, int_answer_one) else: first_score=str_answercheck(score, user_answer_one, str_answer_one) print lines[2] print("A. 5"+'\n'+"B. 6") str_answer_two="A" int_answer_two=5 user_answer_two=raw_input("Select your answer. ") if user_answer_two.isdigit()==True: second_score=int_answercheck(first_score, user_answer_two, int_answer_two) else: second_score=str_answercheck(first_score, user_answer_two, str_answer_two) print lines[3] print("A. 15"+'\n'+"B. 20") str_answer_three="B" int_answer_three=20 user_answer_three=raw_input("Select your answer. ") if user_answer_three.isdigit()==True: third_score=int_answercheck(second_score, user_answer_three, int_answer_three) else: third_score=str_answercheck(second_score, user_answer_three, str_answer_three) print lines[4] print("A. 13"+'\n'+"B. 15") str_answer_four="A" int_answer_four=13 user_answer_four=raw_input("Select your answer. ") if user_answer_four.isdigit()==True: fourth_score=int_answercheck(third_score, user_answer_four, int_answer_four) else: fourth_score=str_answercheck(third_score, user_answer_four, str_answer_four) print lines[5] print("A. 100"+'\n'+"B. 110") str_answer_five="B" int_answer_five=110 user_answer_five=raw_input("Select your answer. ") if user_answer_five.isdigit()==True: fifth_score=int_answercheck(fourth_score, user_answer_five, int_answer_five) else: fifth_score=str_answercheck(fourth_score, user_answer_five, str_answer_five) if choice.lower() == "maths" and difficulty.lower() == "medium": mediumm=open("mathsmedium.txt" , "r") lines = mediumm.readlines() print lines[0] print lines[1] print("A. 30"+'\n'+"B. 35") str_answer_one="A" int_answer_one=30 user_answer_one=raw_input("Select your answer. ") if user_answer_one.isdigit()==True: first_score=int_answercheck(score, user_answer_one, int_answer_one) else: first_score=str_answercheck(score, user_answer_one, str_answer_one) print lines[2] print("A. 100"+'\n'+"B. 110") str_answer_two="B" int_answer_two=110 user_answer_two=raw_input("Select your answer. ") if user_answer_two.isdigit()==True: second_score=int_answercheck(first_score, user_answer_two, int_answer_two) else: second_score=str_answercheck(first_score, user_answer_two, str_answer_two) print lines[3] print("A. 13"+'\n'+"B. 15") str_answer_three="A" int_answer_three=13 user_answer_three=raw_input("Select your answer. ") if user_answer_three.isdigit()==True: third_score=int_answercheck(second_score, user_answer_three, int_answer_three) else: third_score=str_answercheck(second_score, user_answer_three, str_answer_three) print lines[4] print("A. 30"+'\n'+"B. 32") str_answer_four="B" int_answer_four=32 user_answer_four=raw_input("Select your answer. ") if user_answer_four.isdigit()==True: fourth_score=int_answercheck(third_score, user_answer_four, int_answer_four) else: fourth_score=str_answercheck(third_score, user_answer_four, str_answer_four) print lines[5] print("A. 21"+'\n'+"B. 29") str_answer_five="B" int_answer_five=29 user_answer_five=raw_input("Select your answer. ") if user_answer_five.isdigit()==True: fifth_score=int_answercheck(fourth_score, user_answer_five, int_answer_five) else: fifth_score=str_answercheck(fourth_score, user_answer_five, str_answer_five)
Trouver la différence