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