or tag

453 questions


1 answers
147 views
0
Can abstract classes also have constructors?

Can abstract classes also have constructors? If you can, how do you use it and why?


1 answers
90 views
0
What runs on Jupiter's laptop is not working on Python. (NameError: name 'XXX' is not defined)

class Tensor: def __init__(self, data, shape): self.data = data self.shape = shape self.tensor = shape_data(self.data,self.shape) # <-- * def shape_data(self,data,shape): temp1=[] temp2=[] sh...


1 answers
78 views
0
How do I erase elements of vector<> with an index?

How do I erase the nth element in std::vector?How do I write functions such as erase() in the source code below?std::vector<int> vec;vec.push_back(6);vec.push_back(-17);vec.push_back(12);vec.era...

2 years ago

3 answers
106 views
0
How can I change the list element using the for statement in Python?

In Python, you want to change the element that meets the condition to a different value.temp = ['apple', 'banana', 'coke']for i in temp: if i == 'coke': i = 'grape'print(temp)I thought it would be ap...

2 years ago

1 answers
121 views
0
The for syntax and count() behave strangely in python.

data = [1,2,3,4,5,6,7,8,9,10,11,12,13,14]for i in data: if data.count(i) == 1: data.remove(i)print(data)output: [2,4,6,8,10,12,14]Why does an odd number work when I tried to erase the only value?

2 years ago

1 answers
71 views
0
What do you mean by using a static factory method instead of a constructor?

I was working on the Java program, and my friend told me to use the static factory method instead of the creator.I didn't tell you why, but I don't know what this means.


1 answers
97 views
0
I want to change the for statement from C++ to Python, but I'm not sure.

I am a student studying Python.I want to change the for statement below to Python in C, but I don't know how to change it.for (int i = 3; (i*i) <= number; i += 2) { if (number % i == 0) return fals...

2 years ago

3 answers
97 views
0
I'm going into javascript right now. I have a question

Hello, developers. I'm going to make a conditional statement and implement it. if (b!==number) { alert('Number only allowed')}else{a*b}a=What I typed in advance and am currently printing on the screen...

2 years ago

1 answers
106 views
0
I'm asking you a question

Hello, I'm asking you a question because I don't understand while studying data analysis with PandaSas.def make_generation(age): if age == -1: return 'Not entered' elif age // 10 >= 4: Late 30s e...


1 answers
103 views
0
Python UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 0: invalid start byte

Python python -m http.When I entered the command server, there was no error on other computers. But when I input it on my friend's computer, it says, Traceback (most recent call last): and at the end,...

« - 24 - »

© 2024 OneMinuteCode. All rights reserved.