Skip to content
Advertisement

Tag: variables

Get variables from function input and text after

So id like to make varibles from my function input So basically, the if statement should check if the varible is True or not. And i want to use the function input + ”-outcome” to check. Here is an example, to make you understand my problem better! I’ve tried to find a solution but don’t find it anywhere Thanks! Answer

Why can’t I use my local variable despite already returning it?

It says I haven’t defined the variable even though the code that does that is literally right above it, the error message appears: “Traceback (most recent call last): File “main.py”, line 55, in if kategoribmi == “underweight”: NameError: name ‘kategoribmi’ is not defined” I’m really unsure what to do here, I’ve tried looking up how to fix this but I’m

Solving for an unknown variable in python

I’m currently trying to create a body mass index calculator that gives you your BMI and then calculates the difference in weight needed to be at a healthy weight. The equation I’m using to find the BMI is: Using sympy, I’m trying to find how many pounds need to be gained or lost to be within the 19-24 BMI range.

exporting DF to csv with variable file names

I would like to keep this same code but adjust the .to_csv section to save a variable repeating file name I would like the names of the exported files to look like this…I think I need some sort of loop? Period 1 layer 1.csv Period 1 layer 2.csv Period 1 layer 3.csv Period 1 layer 4.csv Period 1 layer 5.csv

Python variable file path and string prefixes

Using tkinter to select output folder for processed files. Would like to use file_output and x as variables for my file path, My attempt: This does not work in my program. The output I need is I am reading the docs https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-stringprefix Still don’t understand how to escape or a workaround, Help would be much appreciated. Answer you can easily

Class variables not callable?

I’ve stumbled on what is probably a simple issue but I struggle to think of a solution. If I try to make a class variable that equates to a number or an array index they come up with these errors and This seems odd since I can set variables equal to ints and arrays elsewhere. What am I missing and

Python local variable to global variable

I’m trying to write a modular script, with functions -Function 1 age = input(“tell me your age : “) -Function 2 weight = input(“tell me your weight : “) -Function 3 birthday = input(“tell me your birthday : “) at the end, i want to send a mail outside functions like : mail_body = age + weight + birthday Thanks

Advertisement