title: High complexity preventing function from
body: <p>Firstly, because the code I am using is big so <a href="https://replit.com/@OldWizard209/Life-SIM#gameplay.py" rel="nofollow noreferrer">here</a> is the link to the code.</p>
  <p>I have this function that runs other functions if a specific input is given:</p>
  <pre><code>allowed_commands = ['help', 'joblist', 'job', 'jobresign', 'work', 'bal', 'balance', 'dep', 'deposit', 'with', 'withdraw', 'fish', 'hunt', 'shop', 'buy', 'sell', 'hunt', 'fish', 'multiply']
  
  def gamePlay():
      while True:
          command = input(f&quot;{bright_green}Command (type [help] to see list of all commands):\n&gt;&gt; &quot;)
          while command in allowed_commands:
              # &lt;-- Display Rules --&gt;
              if command == 'help':
                  rules()
                  break
  
              # &lt;-- Display Jobs --&gt;
              elif command == 'joblist':
                  joblist_function()
                  break
  
              # &lt;-- Get Jobs --&gt;
              elif command == 'job' and working == False:
                  job_funtion()
                  break
  
              elif command == 'job' and working == True:
                  print(f&quot;\n{red}You are already doing a job. You can't work on two jobs,that is dumb...\n&quot;)
                  break
  
              # &lt;-- Resign Job --&gt;
              elif command == 'jobresign':
                  job_resign()
                  break
  
              # &lt;-- Work --&gt;
              elif command == 'work' and working == True:
                  work()
                  break
              
              elif command == &quot;work&quot; and working == False:
                  print(f&quot;{red}\nLOL, you don't have a job, how you gonna work?\n&quot;)
                  break
  
              # &lt;-- Deposit --&gt;
              elif command == 'dep' or command == 'deposit' and deposit_allowed != deposited:
                  dep_money()
                  break
  
              elif command == 'dep' or command == 'deposit' and deposit_allowed == deposited:
                  print(&quot;You have a full bank kiddo...&quot;)
                  break
  
              # &lt;-- Balance --&gt;
              elif command == 'bal' or command == 'balance':
                  display_balance()
                  break
  
              # &lt;-- Withdraw --&gt;
              elif command == 'with' or command == 'withdraw' and deposited != 0:
                  withdraw_money()
                  break
              
              elif command == 'with' or command == 'withdraw' and deposited == 0:
                  print(f&quot;{red}\nNo money deposited. What are you even trying to wothdraw LOL?\n&quot;)
                  break
  
              elif command == 'shop':
                  shop()
                  break
  
              elif command == 'beg':
                  beg()
                  break
  def beg():
      global money
      random_number2 = random.choice([0, 1, 2])
      random_money = random.choice(range(100, 500))
  
      if random_number2 == 1:
          print(&quot;Ewwww beggar. No stonks for u&quot;)
      
      if random_number2 == 2:
          print(f&quot;Mr.beggar, you can have ⏣ {random_money}.&quot;)
          money += random_money
  
  </code></pre>
  <p>But the tooltip on the green line under the function says &quot;Cyclomatic complexity too high: 17 (threshold 15)&quot;.
  <a href="https://i.stack.imgur.com/160B7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/160B7.png" alt="enter image description here" /></a></p>
  <p>Normally, this would work in my code even though the complexity was up to 30. But the code after the last <code>elif</code> is not working. Even when I input 'beg', the function doesn’t run:</p>
  <pre><code>Command (type [help] to see list of all commands):
  &gt;&gt; beg
  Command (type [help] to see list of all commands):
  &gt;&gt; beg
  Command (type [help] to see list of all commands):
  &gt;&gt; 
  </code></pre>
  <p>Why is this happening and how can I solve it?</p>