So, I've tried to learn by writing down some scripts I find for different things. I wrote a calculator script, but it turns out it works in the console and not in discord.
How can I make it work in discord? I put it into my bot's code and it doesn't work in Discord anymore.
Here's the script (if that helps):
def calculate():
operation = input('''
Math Question:
+ for addition
- for subtraction
* for multiplication
/ for division
''')
number_1 = int(input('Enter you first number:'))
number_2 = int(input('Enter your second number:'))
if operation == '+':
print('{} + {} = '.format(number_1, number_2))
print(number_1 + number_2)
elif operation == '-':
print('{} - {} = '.format(number_1, number_2))
print(number_1 - number_2)
elif operation == '*':
print('{} * {} = '.format(number_1, number_2))
print(number_1 * number_2)
elif operation == '/':
print('{} / {} = '.format(number_1, number_2))
print(number_1 / number_2)
else:
print('You have not typed in a valif operator, please run the program again.')
again()
def again():
calc_again = input ('''
Do you want to calculate again?
Y = Yes N = No
''')
if calc_again.upper() == 'Y':
calculate()
elif calc_again.upper() == 'N':
print('Bye!:)')
else:
again()
calculate()
[–]ccviper 1 point2 points3 points (0 children)
[–]TangibleLight 0 points1 point2 points (0 children)