Cell not executed due to pending input

Hi community!
i just started learning python and have been using jupyter notebook. Was trying to run a mean code to calculate it based on numbers pasted with " " in between. I used AI to help me with this code and it worked on google collab, but when I try on Jupyter I get this message:

def calculate_mean_from_space_input(space_input):
    # Split the input string by spaces to get individual numbers as strings
    number_strings = space_input.split(' ')
    
    # Convert each string to a float and collect them in a list
    numbers = [float(num) for num in number_strings]
    
    # Calculate the mean
    mean = sum(numbers) / len(numbers) if numbers else 0
    return mean

# Prompt the user for input
space_input = input("Enter numbers separated by spaces: ")

# Calculate and print the mean
mean = calculate_mean_from_space_input(space_input)
print(f"Mean: {mean}")

Cell not executed due to pending input

The cell has not been executed to avoid kernel deadlock as there is another pending input! Submit your pending input and try again.

Thank you!

It means that you have to type in the input field invoked by input() and submit it. You cannot run the cell again or another cell until you submit the field.

1 Like

I am just new can you explain this again

Same problem coming in my if elif

1 Like

In simple words you might be pressing “Shift+enter” keys after entering an value, which is not correct and its trying to rerun the function instead of taking an input. if you trying to register an input simply press “Enter” key.

3 Likes

Thank you. Your suggestion help.

Brooo thankyou so muchhhh!!! Couldn’t even find the solution for this on utube and i saw the solution u gave and my problem was solved instantly.

1 Like

Thanks a loooottttt
good job