variables

making dynamically named variables in python

making dynamically named variables in python Question: im new to python and im creating a program as sort of a practice exercise. It manages your plants around your house and tells you things like when to water them etc. Currently im working on the section that allows you to add a new plant. The problem …

Total answers: 1

in python, i am using pandas to read a csv file when its working fine tho with other functions but facing an error while using a line

in python, i am using pandas to read a csv file when its working fine tho with other functions but facing an error while using a line Question: i imported panda as pd dataset = pd.read_csv(‘C:\Users\Adminis….’) dataset.plot(x=’tempmin’, y=’tempmax’, style=’o’) pit.show() pit.figure(figsize=(15,10)) #these are working fine pit.tight_layout() seaborninstance.distplot(dataset[‘tempmax’]) pit.show() but i am getting in trouble while …

Total answers: 1

Variable is not accessed in Pylance

Variable is not accessed in Pylance Question: For some reason, I am receiving an error on VSCode that says the specific variable is not accessed Pylance and each variable says the same thing, Am I missing something simple? full code below: score = 0 def gen1_questions(): q1 = input("Question 1. What is the rarest M&M …

Total answers: 1

Declaring Python variables with a specific type

Declaring Python variables with a specific type Question: Python allows me to make the following statement… records = list() ie declare a name/variable that is at present of type ‘List’ The following syntax does not throw a syntax error but I’m not sure what it actually does… records: list() Any ideas when you might use …

Total answers: 1

Python np where , variable as array index, tuple

Python np where , variable as array index, tuple Question: I want to search a value in a 2d array and get the value of the correspondent "pair" in this example i want to search for ‘d’ and get ’14’. I did try with np location with no success and i finished with this crap …

Total answers: 3

How do I create a Data Variable in an xarray.DataArray?

How do I create a Data Variable in an xarray.DataArray? Question: How do I assign data to or create a ‘Data Variable’ in a xarray.DataArray or finally in the nc-file when saving the DataArray? When creating the xarray.DataArray, it simply stores the data as an array but not as a ‘Data Variable’ as one is …

Total answers: 2

How to permanently change a variable in Python?

How to permanently change a variable in Python? Question: I decided to make a code in Python that is like an ATM Machine, and Everything works very well, you can check your balance, extract or add money,and change the PIN code. But when I change the PIN code i tried to assign the "changed_pin_code" variable …

Total answers: 2

How do I change 2 random variables out of 4?

How do I change 2 random variables out of 4? Question: I need to change the value of two random variables out of four to ‘—’. How do I do it with maximum effectiveness and readability? Code below is crap just for reference. from random import choice a = 10 b = 18 c = …

Total answers: 6