Why does 2nd block of this code, where it takes input whether to swim or wait for boat, displays none when I run it?

3 answers

  • answered 2021-06-10 11:19 Nillerh

    It is because you are using a print function inside your input() function. Please read about the use of input() here.

    Correct use:

    choice2 = input("You have arrived at a river bank ...")
    choice3 = input("You have arrived at an island ...")

    Incorrect use:

    choice2 = input(print("You have arrived at a river bank ..."))
    choice3 = input(print("You have arrived at an island ..."))

  • answered 2021-06-10 11:19 Sekomer

    Because you used print function inside the input function. Rearange the code and write the statement inside the print to inside of the input.

    correct use:

    input("foo, boo")

    incorrect use:

    input(print("foo, boo"))

  • answered 2021-06-10 11:33 lollalolla

    Remove the print() in your second code block:


    choice2 = input(print("Your questions?\n")).lower()


    choice2 = input("Your questions?\n").lower()

    When you use print(), your question string is not passed to input(), which outputs a None.