Getting 'Nonetype is not callable' error but I don't know why

I’m trying to create a reaction time game thing, however when I press enter after the hotkey is added I get a super long Nonetype error making reference to several different files. import time import datetime import random import keyboard playing=True def stop(playing): playing=False input("Press enter when you’re ready to test your reaction time!") print("Press… Read More Getting 'Nonetype is not callable' error but I don't know why

Find if any column in pandas dataframe is NULL and state this in new column

I have a dataframe, something like this import pandas as pd dic = {‘animal’:["cat", "dog", "rabbit"], ‘colour’: ["yellow", None, "red"], ‘size’:[None, "large", "small"]} df = pd.DataFrame(dic) animal colour size 0 cat yellow None 1 dog None large 2 rabbit red small I want to create a new column that contains True if any other column… Read More Find if any column in pandas dataframe is NULL and state this in new column

Function is returning NoneType in Python instead of integer

def function(n): if n%4==1: return(n**2) else: n += 1 function(n) # Here for example n=6: if function(6)%2==0: print(function(6)) else: print("Hey!") This is showing the error unsupported operand type(s) for %: ‘NoneType’ and ‘int’. I have tried to convert NoneType with int() but that is telling me to give "str" or other data types as an… Read More Function is returning NoneType in Python instead of integer

Why do I get a print of a tuple of Nones in the Python console, but not of a single None?

While using Python (via cmd) and writing this inside: >>> import random >>> print("hello"),print("world"),print(random.randint(5,10)) the output I’m getting is: hello world 8 (None, None, None) Now I’m not sure why the interpreter returns the tuple of None‘s, but not a single None. >Solution : Python is interpreting the , in the second input line as… Read More Why do I get a print of a tuple of Nones in the Python console, but not of a single None?

Edit regex to recognise very short street name or number for Python 2.7 script and avoid fatal attribute error

I have a little script in Python 2.7 with regex that recognises when a street or avenue name is in a string. However it doesn’t work for street names of only two letters (OK that’s very rare) OR streets with numbers (e.g. 29th Street)… I’d like to edit it to make the latter work (e.g.… Read More Edit regex to recognise very short street name or number for Python 2.7 script and avoid fatal attribute error