I have three lists lst_a to lst_c. I would like to write a function that takes each item from the lists, performs a regex search according to lst_b with search group position according to lst_c and replaces the variables in lst_a with the search results. This is my code: Searching and finding works, but I cannot get the function to
Tag: function
Is there a way to tranfer data from a function into a list?
I keep on trying to get the data from the function to display in the list, I’ve tried using list.append but I keep on getting errors, what am I doing wrong? Answer Your pick_up() function needs to return something. Since it can return either one or two students, you probably want it to return a list of either one or
Why does my turtle not draw my race lanes?
So I’m making a turtle race, but I wanted to make my code shorter by using def. I haven’t used it before but I looked up examples and I have no idea what my code is missing because it doesn’t work. I basically want to draw a lot of “|” but with 15 rows and 5 columns with 20 ‘spaces’
random number generating function as argument in python
I want to pass a function which generates random normal numbers to another function, do some calculations and pass again the random function x times. At the end there should be a Dataframe with x colums with diffrent randomly generated outcomes. My code looks like this: But this gives me always identical columns. Answer I don’t think you can pass
Outputting on multiple lines and I need each line to be assigned to its own variable
The code below takes dna_string2 and matches it within dna_string1. It then outputs the index location of the match or matches and then increments then return value by 1 to simulate “counting itself”. The problem I am facing is that I need the output values of 2, 4, and 10 to be assigned to their own variables. I cannot figure
why returning None in functions python?
first image I was having problem when I run this code I raise exception in function then why none is printing sec image And in this case none is not printing.. pls help Answer when a python function does not have a return statement it automatically return None. In the first image, the print(numcheck(5)) pass the assert but the function
Re Regular expression operations, remove periods?
I’m working with a function I made to split this sample line below to remove the standalone numerical values (123), however it’s also removing the trailing numbers which I need. I also can’t figure out how to remove the “0.0” ABC/0.0/123/TT1/1TT// What’s coming out now is below, notice the 0. and “TT” that’s missing the trailing 1. [ABC], [0.], [TT],
How to create dictionary from multiple dataframes?
I have a folder with several csv files. Example of the dataframes from csv files in directory: I need to make a function that accepts route to file directory and return sites frequency dictionary (one for all sites in file directory) with unique sites names the following kind: {‘site_string’: [site_id, site_freq]} For our examle it will be: {‘vk.com’: (1, 2),
Is there a way to target a particular item in a list if it is not the first item [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 10 months ago. Improve this question So this is the issue: I want the function to print ‘yes’ as long as P0 is in the list(irrespective of whether P58 is in
changing the name of a function in a loop
I didn’t find the answer my problem I have function with names stage_1(), stage_2() e.t.c (to 8). Can I run it using loop? I know this is wrong. what is the right way? Answer I have function with names stage_1(), stage_2() e.t.c (to 8). Actually this is a very bad idea. Can I run it using loop? For sure! You