All Questions
74 questions
0
votes
1
answer
160
views
Python function to merge columns into one column
I am trying to build a function, to apply to different columns with a csv file. The purpose of the function is to combine multiple columns into one, using the combine_first method described here: How ...
0
votes
3
answers
129
views
How to only get one vowel in a list?
I am having trouble getting the function to only print the vowel once if the string contains the vowel more than once. Here is the assignment:
Write Python function vowelList that takes one string ...
-1
votes
2
answers
64
views
How could i append to list any output that my function gives, including errors?
I want to apply my function func to a list of values and collect results. Sometimes it can output errors: JSONDecodeError, IndexError, etc.
A list to which i collect results is result_list. And if ...
-2
votes
1
answer
60
views
My for loop and the dot append function is not giving me what exactly I want
`I am working on a credit card validator that takes in up to 16 digits number which is, (the card number) and return the type of card it is. Before it gets to the part it returns the card type and ...
0
votes
1
answer
385
views
Create a function which takes a list as an argument and keeps only the numbers that are greater than 5
I am trying to create a function that takes a list as an argument and keeps only the numbers that are greater than 5 by creating a new empty list inside the function and only append it with numbers ...
1
vote
1
answer
73
views
Vector of functions
I want to create a function that is modified with a loop and then I can call those different functions from a function vector.
The function to be modified would be the Am function.
The problem is that ...
0
votes
2
answers
46
views
Wrong output in function
Hi I'am totally new to programmering and i have just jumped into it.
The problem i am trying to solve is to make a function that standardized an adress as input.
example:
def standardize_address(a):
...
-1
votes
1
answer
23
views
Python Getting Last evalues of a loop
I have a definition and it repeats with a while loop. I want to pull the penultimate value of m and ar from the operations that occur in the definition in each loop.
To do this, I opened an out file ...
0
votes
2
answers
60
views
How to append output values of a function to a new empty list? [duplicate]
My aim is to create a function, list_powers, and use a for loop to take a list and return a new list (power_list) where each element is exponentiated to a specified power.
I have moved the return ...
-1
votes
1
answer
34
views
Python is not printing List functions
I wrote this code while i was in my university class. However, when i go to run the program nothing is printing into the console.
def create_list():
return ["Playstation", "Xbox&...
0
votes
1
answer
718
views
How to append to a specific line in textfile
I have to make a program where someone has to approve or disapprove reviews from a text file and add if it is approved or not. The text file is structured like this:
Dave;Good customerservice
Suzan;...
-1
votes
1
answer
220
views
I wrote a code that would print the odd numbers or the even numbers in a list according to users choice. But the append not working inside the def
I created a code that takes a list from the user and then asks the user to choose from printing only the odd numbers or the even numbers. But whenever the user choice is taken, the execution freezes. ...
0
votes
2
answers
120
views
Python lists not updating with .append()
I am trying to make a program that stores drinks and displays them when a user wants to (when they click b5), but the .append() function isn’t working. I think it’s because the list is not saving ...
0
votes
1
answer
42
views
Why is a += b not equivalent to a = a + b here? [duplicate]
I was shocked to find out that a += b behaves differently from a = a + b in my code, and I am able to reduce the issue to the following simple question:
Let's say I have a function g that depends on f ...
0
votes
1
answer
51
views
How to return appended data frame using a function in Python?
I would like to return each data frame from each URL appended into one single data frame. When I print it within the function, I get the result I desire. The problem is when I try assign a variable to ...