@Koveras - true story. My 10 year old is learning the piano. Her music teacher gave her 'homework'. The theme for an upcoming concert was 'Canadian Music'.
Say if I have this trivial program
List<String> input = Arrays.asList("1", "2", "3");
List<String> result = input.stream()
.map(x -> x + " " + x)
.filter(y -> !y.startsWith("1"))
.collect(Collectors.toList());
Behind the scenes does it work like a) o...
Her speech she prepared was: so and so wrote this song in 1998, when they were a student at such and such. They now live at 1234 this street in this town.
But if someone knows your real name and state, and they are determined enough to destroy your internet persona, even with just that information they could find you
Well, maybe not but I wouldn't be surprised
Oh and @Simon, it wasn't even a "fight" - it was "wow you're a Christian you are a terrible person"
But much worse words were used
Anyways it freaked me out enough that I've been on a crusade to change all my usernames since
Well, leveraging the type system is often useful, e.g. when writing a “fluent API”. But in this example of file IO, I wouldn't want a type-system based solution, except maybe in Haskell
@rolfl my example was about an illegal state, not about about changing state itself. But you may be right that I am not describing the correct term. Wikipedia says this:
Although this is not related to optimization, it looks like you could replace some while loops with for loops. If you're using a counter, chances are you should use the latter type of loop.
First, I want to mention that you should use whitespace between operators and keywords for readability. ...
So, @Jamal - in your first edit.... you changed the text description .... the answer mod 10^9 +7. to be .... the answer mod 10<sup>9</sup> +7 .... are you sure that was the right thing to do?
@SimonAndréForsberg - I saw the description saying 10 to power 9 and immediately thought 'overflow' From that point on I was expecting to see power operator, and, it does exist somewhere in my past as the caret ^
Clarification: In the description it says: Since the number of ways can be very large output the answer mod xxxx. Is the xxxx10-to-the-power-of-9-plus-7, or is it 10-xor-9-plus-7 ? — rolfl ♦31 secs ago
Although this is not related to optimization, it looks like you could replace some while loops with for loops. If you're using a counter, chances are you should use the latter type of loop.
First, I want to mention that you should use whitespace between operators and keywords for readability. ...
Things you did well
Readability - everything was well organized and spaced neatly.
Initializing variables within your for loops/adhering to the C99 standard (which is the minimum you should abide by in my opinion).
Marking your function arguments as void when you don't take in any parameters.
U...
@ChrisW I probably did jump the gun on this one, but it did seem unusual to me. Hopefully we'll be clarified on this, unless it's already determined what was being done.
My query is on the below program with respect to symbols that are storing values and functions, when ran on http://pythontutor.com/.
My question is:
How does python execution model look for above program on memory before start interpreting the python program? How do i visualise that memory l...
part(1) function is stored as an object with class 'function' but here in my second query i got the chance to know how where my code is embed it is code attribute
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in US and Canadian Social Insurance Numbers. It was created by IBM scientist Hans Peter Luhn and described in [http://www.google.com/patents?id=Y7leAAAAEBAJ U.S. Patent No. 2,950,048], filed on January 6, 1954, and granted on August 23, 1960.
The algorithm is in the public domain and is in wide use today. It is specified in ISO/IEC 7812-1. ...
... which you linked to. Try implementing it yourself in C.
@Sham Sorry, I don't follow your question at all. Perhaps you could provide some specific code as an example to discuss?
actually am asking such questions because am getting better sense when am writing code where nothing is typed statically in python, am able to visualise my code in a better way, am actually not using this info anywhere practically
I'm having trouble getting this to compile. I believe it has something to do with my kelly brackets b/c my error says:
C:\Users\Pivo\Google Drive\CIT130 - Java\Chapter 6\PP65.java:72: error: illegal start of expression
}//end for
^
C:\Users\Pivo\Google Drive\CIT130 - Java\Chapter...
I'm doing my homework and it says to write a test program that prompts the user to enter ten double values, invokes this method, and displays the average value. I was able to get this program working with an overloaded method... but I'm curious to hear your feedback on where I can improve and wha...
We do not fix code. We review code. Stack Overflow fixes code. You have posted a question here before that was off-topic for the same reasons as well, with comments telling you this. Please listen to them. — syb0rg1 min ago
More stern, since this is the second time he has been told.
You seem to be mixing up Code Review and Stack Overflow. Your most recent question on SO should have been posted here, and this question should have been on SO. The difference between SO and CR is, once and for all: StackOverflow - I have broken source code:"I tried to do it right, but it's broken, how do I fix it?"CodeReview - I have finished source code:"Now that I've done it, can it be made better?" Please come back here when you have code without errors and that it works as intended. We will gladly help you clean your code up once it is working correctly. — Simon André Forsberg1 min ago