Nov-01-2018, 10:37 PM
Overall My program is good. But I am having trouble figuring out how to do a few things. I could really use some help. I need to know how to fix my parenthesis appearing above all the other text and make it display inside the expression as well as get rid of the "None" text appearing in my expression. The last thing is I don't know how to make my answer variable(line 43) = the answer to the expression. By the way, the outcome is when I took out line 43. Thank you for your help!

import time from tkinter import * import random answer_input = 0 answer = 0 sign_list = ['+','-','*','/'] power_list = ['P0', 'P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8',' ', 'SR0', 'SR1', 'SR2', 'SR3', 'SR4', 'SR5', ' ', ' ', ' ', ' ', ' ',] Open_Parenthesis_list = random.randint(0, 1) Open_Parenthesis_list2 = random.randint(0, 1) Closed_Parenthesis = [')'] print("A random expression will be created that you must solve. *IMPORTANT: SR-Square Root, P2-Squared, P3-Cubed, SR2-Square root of, etc.") print(' ') Random_Number1 = random.randint(0, 100) Random_Number2 = random.randint(0, 100) Random_Number3 = random.randint(0, 100) Random_Number4 = random.randint(0, 100) Random_Number5 = random.randint(0, 100) Random_Sign1 = random.choice(sign_list) Random_Sign2 = random.choice(sign_list) Random_Sign3 = random.choice(sign_list) Random_Sign4 = random.choice(sign_list) Random_Sign5 = random.choice(sign_list) Random_Power1 = random.choice(power_list) Random_Power2 = random.choice(power_list) Random_Power3 = random.choice(power_list) Random_Power4= random.choice(power_list) Random_Power5 = random.choice(power_list) PE = Open_Parenthesis_list PE2 = Open_Parenthesis_list2 if PE == 1: ParenthesisA1 = print('(') ParenthesisB1 = print(')') else: ParenthesisA1 = print(' ') ParenthesisB1 = print(' ') if PE2 == 1: ParenthesisA2 = print('(') ParenthesisB2 = print(')') else: ParenthesisA2 = print(' ') ParenthesisB2 = print(' ') print(ParenthesisA1, Random_Number1, Random_Power1, Random_Sign1, Random_Number2, ParenthesisB1, Random_Power2, Random_Sign2, ParenthesisA2, Random_Number3, Random_Power3, Random_Sign3, Random_Number4, ParenthesisB2, Random_Power4, Random_Sign4, Random_Number5, Random_Power5,) answer = input = answer_input if answer_input == answer: print(' ') print('Nice Work! You Really Know Your Stuff.') else: print(' ') print('Sorry... That is Incorrect')
Output:A random expression will be created that you must solve. *IMPORTANT: SR-Square Root, P2-Squared, P3-Cubed, SR2-Square root of, etc.
(
)
(
)
None 64 SR3 * 23 None P5 - None 63 SR1 / 57 None SR5 * 1 P5
Nice Work! You Really Know Your Stuff.