Nov-04-2018, 09:13 PM
I made an expression creator. I only need one more line to fill in which is line 48. I would appreciate it if someone could give me code for line 48 and if any other code is needed just tell me and I can figure out where to put it. Also for lines 49, 51, and 52 I had it return what the variables were equivalent to. In the input it shows that both are equivalent to 0 but the coding on lines 53-58 return it as "answer" and "answer_input" to not be equivilent. Can someone tell me why that is. BTW the output is without line 48.
import time from tkinter import * import random import math answer_input = 0 answer = 0 ParenthesisA1 = 0 ParenthesisB1 = 0 ParenthesisA2 = 0 ParenthesisB2 = 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. Also if it says SR of a negative just leave the number as is without the SR") print(' ') Random_Number1 = random.randint(-100, 100) Random_Number2 = random.randint(-100, 100) Random_Number3 = random.randint(-100, 100) Random_Number4 = random.randint(-100, 100) Random_Number5 = random.randint(-100, 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 = '(' ParenthesisB1 = ')' else: ParenthesisA1 = '' ParenthesisB1 = '' if PE2 == 1: ParenthesisA2 = '(' ParenthesisB2 = ')' else: ParenthesisA2 = '' ParenthesisB2 = '' 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 = print(answer_input) print(answer) answer_input = input('Answer Here: ') print(answer_input) print(answer) 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. Also if it says SR of a negative just leave the number as is without the SR
( -92 P6 + 5 ) P2 * -38 SR4 + -19 P1 - 78 P6
0
0
Answer Here:
Output:A random expression will be created that you must solve. *IMPORTANT: SR-Square Root, P2-Squared, P3-Cubed, SR2-Square root of, etc. Also if it says SR of a negative just leave the number as is without the SR
( -61 - 52 ) P7 / ( 33 SR4 * 5 ) P7 / -84 P5
0
0
Answer Here: 0
0
0
Sorry... That is Incorrect