Sep-14-2020, 09:12 AM
I honestly have no idea what is going on or why my code will not work :(
\/For some reason this numbers.py file is being called as well which confuses the hell out of me\/
import sys first_num = int(sys.argv[1]) second_num = int(sys.argv[2] if first_num + second_num <= 0: print('You have chosen the path of destitution.') elif first_num + second_num is >= 1 and <= 100: print('You have chosen the path of plenty') elif first_num + second_num > 100: print('You have chosen the path of excess.')^This is the branching.py file which I am getting an error from^\/For some reason this numbers.py file is being called as well which confuses the hell out of me\/
import sys first_number = float(sys.argv[1]) second_number = float(sys.argv[2]) result_sum = first_number + second_number result_difference = first_number - second_number result_product = first_number * second_number result_quotient = first_number / second_number print(f"{first_number} plus {second_number} equals {result_sum}") print(f"{first_number} minus {second_number} equals {result_difference}") print(f"{first_number} multipied by {second_number} equals {result_product}") print(f"{first_number} divided by {second_number} equals {result_quotient}")\/In the Terminal you see it calls this numbers.py file that I did not run and then it gives me this weird error.\/Error:manus@Sys-Main:~/Python/Twilio$ python3 branching.py 20 20 20.0 plus 20.0 equals 40.0 20.0 minus 20.0 equals 0.0 20.0 multipied by 20.0 equals 400.0 20.0 divided by 20.0 equals 1.0 File "branching.py", line 8 if first_number + second_number <= 0: ^ SyntaxError: invalid syntax Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module> from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 32, in <module> import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 12, in <module> import os, glob, subprocess, os.path, time, pwd, sys, requests_unixsocket File "/usr/lib/python3/dist-packages/requests_unixsocket/__init__.py", line 1, in <module> import requests File "/usr/lib/python3/dist-packages/requests/__init__.py", line 112, in <module> from . import utils File "/usr/lib/python3/dist-packages/requests/utils.py", line 26, in <module> from ._internal_utils import to_native_string File "/usr/lib/python3/dist-packages/requests/_internal_utils.py", line 11, in <module> from .compat import is_py2, builtin_str, str File "/usr/lib/python3/dist-packages/requests/compat.py", line 29, in <module> import simplejson as json File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 110, in <module> from decimal import Decimal File "/usr/lib/python3.8/decimal.py", line 3, in <module> from _decimal import * AttributeError: module 'numbers' has no attribute 'Number' Original exception was: File "branching.py", line 8 if first_number + second_number <= 0: ^ SyntaxError: invalid syntax 