python progam doesn’t proceed from one function to the next
I’m calling 2 functions from 2 different python packages which individually run and finish with exit code 0 without error. However when I call these functions from my main program.py file the first function will run but will not end and proceed to the next function listed.
Python – Define a function with changing argument and insert that function into another function
Let’s say I have two functions where one depends on the other. I need to now put the first function inside the second function, and then integrate.
(UnboundLocalError: local variable ‘rare’ referenced before assignment) keeps occuring randomly
The following error keeps occuring in this function and others like it that are similar, I cannot seem to figure out why, does anyone have a solution?
Python Function Reprinting Prior Input() Contents
secret_word = “hello” guess = “” def get_guess(): guess = input(“Guess: ” ) if guess.isalpha() is not True: print(“Please input a letter”) get_guess() if len(guess) > 1: print(“Please input a single letter!”) get_guess() guess = guess.lower() print(guess) get_guess() Code above for a school project, when reaching the “print(guess)” line, will print all prior content. As […]
use a variable in a different function
I have an issue in python. I have two function:
Mapping a numpy matrix to a matrix of character strings
I have digital matrix consisting of 0s and 1s. Example:
how to create and return a dataframe in a function?
I have a function pmi_count_phrase_create() where I input 2 lists want to return a dataframe composed of the lists I create in the function. Problem right now is I am getting a tuple containing the three lists instead.
Why doesn’t my code have the output I want?
def calculate_average_height(height_data): total_height = sum(height_data) average_height = total_height / len(height_data) return average_height def find_closest_height(height_data, average_height): closest_height = min(height_data, key=lambda h: abs(h – average_height)) return closest_height def find_second_closest_height(height_data, closest_height): second_closest_height = min([h for h in height_data if h != closest_height], key=lambda h: abs(h – average_height)) return second_closest_height def main(): city_data = [ {“city”: ‘Ely’, ‘Population”’: 10, […]
Can someone please explain to me why my code isn’t putting the output i want?
so this code is suppose to output all the data that goes with each town name, but its not outputting anything and im a little lost.
Called function adding too many values / Repeating added values
I’m making a blackjack code and having problems with my function. Whenever I call this function, the first time it works and the value is saved but when it appears the 2nd time it adds the first total AGAIN along with the 2nd total.
eg 1st card = 7, total = 7, 2nd card = 3, total = 17 (it should be 10)