I want to create a script that run at a specific date everyday given the variable status as a parameter. The status can take two entries: “past” or “present”. I want to save the current date as a parameter and use it after in a function to make different calls. So the current time becomes also a parameter. For example,
Tag: parameters
Issue with Subprocess Popen Python
I searched on stack overflow but I did’nt find a correct answer. I use subprocess popen to call and run an entire python script and it works fine, like that : subprocess.Popen([‘python3’, ‘/home/pc/Dossier/Dossier2/Nom.py’], ) But in my system I want to modify a variable in the script Nom.py when I call it with subprocess popen. I heard about inputs parameters
How to get parameter names from a parametrized string?
What I’d like is: I’ve looked through string.Template, it does only substitution. Is there a standard library way to do this? Because in case of regex, there would have to be a check if $smt is actually a valid Python variable name and so on. Answer string.Template, or one of its subclasses, stores the compiled regex that will be used
Python Function parameters and arguments
I want to understand functions and arguments better, I’ve read and this is my implementation of what I have read. I have 3 small functions to illustrate my point. User input collection, grading function and main. If I run the main function without its argument (1), it results in an error looking for the argument. I know that I declared
Default Parameter Confusion
I know that Python’s default parameters are only evaluated when the function is created, but I’m confused in my example why my first default parameter is getting reset each time but my empty set isn’t. In the below, I am calling the main_func() from somewhere else with a list of dates. Then iterating through the dates to collect a bunch
Why does my program run without parameters inside the functions’ parenthesis?
I am going to ask probably a very silly question. I designed a code that looks like the following: main_data looks like this: Now, the “problem” is that my program runs exactly as it should. I just realized, however, that all of my functions, options(), Option1() and Option2(), do not have parameters inside the parenthesis. This is due to me
Sweeping a parameter for an ODE function python
This isn’t an ODE question, per see. It’s more of a referencing issue, I think (but I might be wrong). I’ve copied the code below. I can’t seem to sweep parameters for an ODE function that I would like to run. Any advice/insight on how to fix this problem would be greatly appreciated! Thank you very much in advance! CONTEXTUAL
What is the difference between a variable and a parameter
I am learning python 3 and programming in general for the first time, but I can’t seem to distinguish a parameter and a variable? Answer A variable is just something that refers/points to some data you have. Here x is a variable. Variables can point to more kinds of data than just numbers, though. They can point to strings, functions,
Python 3: Calculating percentage change with n number of values
I have a function which should calculate percentage increase / decrease between two values. The parameters in the function are original_value and new_value. Problem: I need the program to take n number of values, for example, six values, and then run the function on every pair of values. An example: The values are 1, 2, 3, 4, 5 and 6.
how to access a dictionary from another function in the current function
I am trying to refer to the dictionary in function_one. I have tried to return the dictionary variables, and use the dictionary names as parameters and arguments. However, I am getting an error message saying that the dictionaries I am trying to access in function_two is not defined. Here is my simplified code: Basically, I am asking if the element