From 82ae966c77d129d8f2d54c52638a4300df306bb5 Mon Sep 17 00:00:00 2001 From: mohammed masud Date: Thu, 1 Oct 2020 20:30:18 +0100 Subject: [PATCH] added text generator to make pasting easier --- alternative.py | 6 ++++-- textgenerator.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 textgenerator.py diff --git a/alternative.py b/alternative.py index 8289c6b..9cc6542 100644 --- a/alternative.py +++ b/alternative.py @@ -1,11 +1,11 @@ -''' +""" sphinx story is good https://github.coventry.ac.uk/lycette2/CuriosityKilledTheSphinx -''' +""" history = [] # empty storage area for choices @@ -73,6 +73,7 @@ def getAnswer2(question, text): # function to handle 2 responses from the user history.append(choice.upper()) # adds the choice the user picked + def getAnswer3(question, text): # function to handle 3 responses from the user loop = True choice = "" @@ -130,6 +131,7 @@ def getAnswer4(question, text): # function to handle 4 responses from the user history.append(choice.upper()) # adds the choice the user picked + # Main block start() diff --git a/textgenerator.py b/textgenerator.py new file mode 100644 index 0000000..2fa3843 --- /dev/null +++ b/textgenerator.py @@ -0,0 +1,20 @@ +optionsList = ["A", "B", "C", "D", "E", "F"] + +options = input("How many options? (max = 6)->") +line = "text = {" + +for i in range(1, int(options)+1): + if int(options) == 1: + textInput = input("Paste the text for option " + optionsList[i-1] + ":") + line = line + "\"" + optionsList[i-1] + "\": " + "\"" + textInput + "\"}" + elif i == 1: + textInput = input("Paste the text for option " + optionsList[i - 1] + ":") + line = line + "\"" + optionsList[i - 1] + "\": " + "\"" + textInput + "\",\n" + elif i < int(options): + textInput = input("Paste the text for option " + optionsList[i-1] + ":") + line = line + " \"" + optionsList[i-1] + "\": " + "\"" + textInput + "\",\n" + else: + textInput = input("Paste the text for option " + optionsList[i - 1] + ":") + line = line + " \"" + optionsList[i - 1] + "\": " + "\"" + textInput + "\"}" + +print(line)