syntax tag

30 questions


1 answers
114 views
0
What is the role of __all__ in Python?

I'm studying Python. In the _init__.py file,__all__ <- I keep looking at itWhat do you use this for?

2 years ago

1 answers
87 views
0
What are ** and * in the parameters?

What does * and ** attached to param2 do in the code below?def foo(param1, *param2):def bar(param1, **param2):


1 answers
90 views
0
int main(){([](){}()));} Why does it run normally?

I'm asking you a question because I saw such a strange code.I don't know why ([](){})()); is compiled normally in the source code belowI'm not a function pointer, I'm not an operator.But if you run it...


1 answers
91 views
0
Why do we use colons (:) in constructors?

I saw a code like this#include <iostream>class Foo {public: int bar; Foo(int num): bar(num) {};};int main(void) { std::cout << Foo(42).bar << std::endl; return 0;}What is written her...


1 answers
81 views
0
Is it "long long int" = "long int long" = "int long"?

Both can be compiled. Can I change the order like int long , long int, and long int?If the top two are the same, is the pointer type the same?

2 years ago

2 answers
110 views
0
To remove all annotations

How do I remove all annotations from the Python code?I made a code to find a pair of # or and erase the contents of itOccasionally, a problem occurs when the is used as a string.Isn't there a Python...


1 answers
92 views
0
Can I set the parameter type and share int foo(someVar){}?

int foo(someVar){ return someVar;}int main(int argc, const char * argv[]) { printf(%d\n, foo(3));}SomeVar, the factor of foo(), doesn't have a typeThere are no compilation errors and the program runs ...

2 years ago

1 answers
121 views
0
How to write an if-else statement in one line

if count == N: count = 0else: count = N + 1Is there any way to write this code in one line?In object-C, count = count == N ? 0 : count + 1;We could have shared it, but I don't know exactly what that i...

2 years ago

1 answers
103 views
0
SyntaxError: check why invalid syntax appears

After you push the computer once and install Python,I just used print, but there's an errorWhat should I do? Should I reformat my computer?>>> print hello World File <stdin>, line 1 pri...

2 years ago

1 answers
131 views
0
What are the two colons in Ruby doing?

What does :: do in Foo::Bar?I thought it was related to encapsulation (private, protected), but it's not that when I looked at the definition.The :: is a unary operator that allows: constants, instanc...

2 years ago
- 1 - »

© 2024 OneMinuteCode. All rights reserved.