0
    a = input("How many Stocks: ")


if a == 1:
    OneStock()
if a == 2:
    TwoStock()
if a == 3:
    ThreeStock()
if a == 4:
    FourStock()

def OneStock():

    a = input("Ticker: ")

    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    driver.get("https://www.benzinga.com/quote/" + a)

def TwoStock():

    b = input("1.Ticker: ")
    c = input("2.Ticker: ")

    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    driver.get("https://www.benzinga.com/quote/" + b)

    driver.execute_script("window.open('about:blank', 'secondtab');")
    driver.switch_to.window("secondtab")
    driver.get("https://www.benzinga.com/quote/" + c)

def ThreeStock():

    d = input("1.Ticker: ")
    e = input("2.Ticker: ")
    f = input("3.Ticker: ")

    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    driver.get("https://www.benzinga.com/quote/" + d)

    driver.execute_script("window.open('about:blank', 'secondtab');")
    driver.switch_to.window("secondtab")
    driver.get("https://www.benzinga.com/quote/" + e)

    driver.execute_script("window.open('about:blank', 'thirdtab');")
    driver.switch_to.window("thirdtab")
    driver.get("https://www.benzinga.com/quote/" + f)

def FourStock():

    g = input("1.Ticker: ")
    h = input("2.Ticker: ")
    i = input("3.Ticker: ")
    j = input("4.Ticker: ")

    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)

    driver.get("https://www.benzinga.com/quote/" + g)

    driver.execute_script("window.open('about:blank', 'secondtab');")
    driver.switch_to.window("secondtab")
    driver.get("https://www.benzinga.com/quote/" + h)

    driver.execute_script("window.open('about:blank', 'secondtab');")
    driver.switch_to.window("secondtab")
    driver.get("https://www.benzinga.com/quote/" + i)

    driver.execute_script("window.open('about:blank', 'secondtab');")
    driver.switch_to.window("secondtab")
    driver.get("https://www.benzinga.com/quote/" + j)

The four functions aren't being executed after the input a. It just ends the program, any ideas? and btw before i added all Functions at the end but that did not work because all four functions were executed one by one. (whoever deleted this bevor was wrong, you said my problem was similar to another post but it did not help me at all, di not have anything to do with my problem)

  • You are explicitly running all of `OneStock()`, `TwoStock()`, `ThreeStock()`, and `FourStock()` at the end of your file, so all of them are going to run, one after the other, just like you say is happening. If you don't want that to happen, then you need to remove those four lines at the end. – Makyen Aug 02 '21 at 22:32
  • 1
    As to your issue with it not executing based on the `input()` which you are providing, that's a duplicate of [How can I read inputs as numbers?](https://stackoverflow.com/q/20449427/3773011). – Makyen Aug 02 '21 at 22:36
  • @Makyeni removed the four functions at the end, and now they are'nt running at all anymore – Adrian Reichert Aug 03 '21 at 10:25
  • Yes, that's expected, if the only thing you did was remove those four lines. My second comment, mentioning that this is a duplicate, already addresses the issue of nothing running based on the input you provide to the program. – Makyen Aug 03 '21 at 13:29

0 Answers0