output

ctypes character pointers with same byte string points same location

ctypes character pointers with same byte string points same location Question: I am creating two ctypes character pointers with same byte string via: import ctypes as ct var1 = ct.c_char_p(b’.’*80) var2 = ct.c_char_p(b’.’*80) # how I check the values: api = ct.CDLL(‘api.dll’) api.function1(var1, var2) # values of the vars are changed after running the above …

Total answers: 2

No output from print function

No output from print function Question: I am trying to create a program where a letter (in order), a,e,o,s,t, or r, is input and another letter, r,t,s,o,e, or a, is output. For example, if I were to enter a, I would receive r. I am also trying to make this case sensitive, so that if …

Total answers: 3

sklearn: Set the valute to the attribute out_activation_ to 'logistic'

sklearn: Set the valute to the attribute out_activation_ to 'logistic' Question: I need to set the attribute activation_out = ‘logistic’ in a MLPRegressor of sklearn. It is supposed that this attribute can take the names of the relevant activation functions (‘relu’,’logistic’,’tanh’ etc). The problem is that I cannot find the way that you can control …

Total answers: 1

get output element by element when input a list

get output element by element when input a list Question: enter image description hereI want to enter numbers separated by spaces as input. Store the numbers in a list and get the elements by elements in that list as output. This was my code. lst = input() test_list =[] for ele in lst.split(): n_int = …

Total answers: 3

Why a string starting with 'cat….' outputs with a different color in Programiz?

Why a string starting with 'cat….' outputs with a different color in Programiz? Question: I can’t figure out why when I print a string starting with ‘cat..’ (like category, cathedral, catch, …) in the Programiz Online Python Compiler it appears in green (or gray and italic in dark mode) instead of black (or white in …

Total answers: 2

Why is my code returning the address of the variable instead of the value?

Why is my code returning the address of the variable instead of the value? Question: I am finding it difficult to understand why my code is returning my memory address. I have tried to use __str__ and __repr__ respectively but maybe I am unfamiliar with how these work exactly. import random class Card: def __init__(self, …

Total answers: 3

Either no errors, yet no output or math domain error

Either no errors, yet no output or math domain error Question: I’m currently majoring in maths and minoring in physics and hence need to do some homework assignments in Python. I never coded in Python(miniscule experience in java) and never attended the Python classes assigned by uni(ik) and currently I try to approximate pi by …

Total answers: 1

Loop over lines in file, create list from 2nd column

Loop over lines in file, create list from 2nd column Question: I’m trying to loop over the lines in an output file I created that looks like this: 2020-03-19, 22.0 2020-03-20, 6.0 2020-03-21, 5.0 And then create and print a list with the numbers in the 2nd column. This is just my main and the …

Total answers: 2

How to save outputs of for loop into a dataframe in Jupyter

How to save outputs of for loop into a dataframe in Jupyter Question: I have a for loop as follow: Region = [‘A’, ‘B’, ‘C’, ‘D’, ‘E’] i = 5 for Region in Region: rr = q * s.at[i+1, ‘Value’] tt = w * s.at[i+1, ‘Value’] yy = e * s.at[i+1, ‘Value’] print(Region, rr, tt, …

Total answers: 1