TRENDING NEWS

POPULAR NEWS

Python 3.4 Hw. Any Help Is Appreciated

Python 3 How to sort dictionary?

I'm making a trivia game which records the scores of the players and I want to store them in a file in a descending order. So when I print them out, the highscores show top 1 to n, n being the however number of player plays the game. (or it could be just top 10)

Here's my code:

scoreReader = open("highscore.csv","r")
for line in scoreReader: line = line[0:-1]
name, score = line.split(",") dictScore[Snumber] = {name: score}
Snumber = Snumber+1

print(dictScore)
sorted_dict = sorted(dictScore.items(), key=operator.itemgetter(1))
print(sorted_dict)
scoreReader.close()

it doesn't sort the values so idk what to do. HALP

I'm 13 and want to be a programmer. If human colonization on Mars becomes a thing, is it possible for me to go to Mars and be helpful there?

I feel that some of the answers here might be overlooking an important point: Mars is anywhere between 3 and 22 light-minutes away from Earth. That doesn’t matter so much if you’re just deploying software. But software development also involves customizing, patching, debugging, and testing. Imagine a bug in the oxygen management system.Now, don’t write that off as implausible. This sort of problem cannot be mitigated by “proper testing” or anything else, no matter how important the system is. If you’re not convinced, here’s a “fun” experiment to try: do a Google search for “software glitch” plus the name of *any* critical system. Nuclear plant? Nasdaq? Air traffic control? Pacemakers? Yep. Mark my words: one day, “software glitch in Martian oxygen system” is going to be part of a news headline.If a Martian discovers that bug while Mars and Earth are far apart, it’ll take 22 minutes for the Earthling programmers to hear about it. Add 22 minutes more for the first response from Earth to Mars - maybe the message is “we’re not sure what’s wrong, but we’ve sent commands to your systems that will start diagnostics.” 22 minutes more for the diagnostics to come back to Earth. 22 minutes more for the first patch. Already we’re up to an hour and a half in communication delays, never mind the actual work. That’s about an hour and a half longer than I want my oxygen system to be broken. If the programmers don’t identify and repair that bug correctly on the first pass, it’s gonna take another 44 minutes every time they get new data and offer a new patch.Also, every so often, Earth and Mars have a communications blackout that lasts about 14 days. I don’t think I can hold my breath that long.Someday, the presence or absence of software engineers on Mars will determine whether the headline “software glitch in Martian oxygen system” finishes with the words “was identified and repaired” or “resulted in tragedy.”

Why are pointers used in C/C++?

Summarilly pointers are the only actual abstraction showing access to underlying memory and you need them for any kind of controled memory allocation. If you remove them from the language (as it was done in other languages), you are losing something that can't be replaced.Going to details, most pointer uses can be replaced by references, but there is still a visible few cases where references can't replace them. void pointers is such a case. There is some functions expecting the address of something where something is untyped (like memcpy). Accessing hardware from addresses is another such case.Heap memory allocation (through malloc or new) implies pointers (even if you can dereference return of new to assign to reference). To remove pointers we would have to change new to something else. References provides no tool for memory allocation. And there is even some cases where underlying implementation is horrible (like allocation of at least one byte fior every struct, including empty ones to ensure all references are at different addresses) Also a reference is unique henceforth you can't really change it and this ability is needed for many dynamic data structures. To change that you would have to change both new and delete to something else (for instance the Java way), but doing so you are losing control on the low level.What could probably be removed is equivalence between pointers and arrays. This is an ongoing process as there is more and more restrictions on the subject, like C++ forbidding to compute some intermediate address out of the array (except the next to last) even if you never dereference it. To my eyes a C++ without pointers should look very much like Java (if we ignore other differences like templates). If this is a good  evolution or not is another question. I would say if it evolves this way, C++ won't fit the "portable assembly" historic ecological niche of C language any more. Henceforth we would need another low-level object oriented language to replace it for that purpose.

I just got offered a job at Google. The base pay is 19% lower than my current job. The total comp after bonus and GSU is still 7% lower. I think the opportunity to work at Google would be great, but the comp level is disappointing. What should I do?

[This answer is focused on engineering ladder positions, and may be bad advice for non-engineering positions]The single most important part of your offer is the level that you are being hired at. Until your first promotion, all future raises and refreshes will be based on this level. Your initial offer is also based on this level (although there is significant room to adjust within each level).Total Google compensation is, by design, excellent for equivalent positions. It’s not impossible to find positions that pay more than Google, but it is hard.If your current job pays more than Google is offering, you are probably a reasonable candidate for a Google position that is one level higher.The recruiter is on your side. He wants to hire you. He is incentivized to hire you. He is also an expert on the Google hiring process, and has a strong understanding of what is and is not possible.Tell your recruiter that you are disappointed with your offer. Tell him that you think you are further along in your career than the offer suggests. Tell him that you want an offer that is one level higher with a matching base salary and initial equity grant.The recruiter already knows how realistic this is. Listen carefully to what he says about your chances of getting an offer one level higher.Ignore anything the recruiter says about getting promoted quickly. There are all sorts of true (and untrue) things he can say about this that serve no purpose other than to distract you from getting an offer that is one level higher.If the initial offer is lower than T5 [lower than Senior SWE], consider passing on the opportunity unless they slot you appropriately. Google won't stop being interested in you. The next time you interview you can make sure that you are evaluated at an appropriate level. (Also, if this is clearly your attitude, the recruiter will do what he can to get you the level you want right now.)If the initial offer is T5 or higher, getting slotted at a higher level may be unrealistic. Tell the recruiter that this is what you want. But if your goal is to work at Google at some point, be prepared to accept additional compensation instead. Getting new non-managers in at T6 or higher is a major pain and is not realistic for the vast majority of people who get a T5 offer.

Which programming languages have great scope for getting a job as an embedded hardware/software engineer in India?

Thanks for the A2A.I have been in the embedded field professionally for 3+ years now and dabbling with it for 3 more.In my little experience, C comes across as a single most important language that you need to know well as far as microcontroller-based embedded systems go. To be more specific, you need to have a decent understanding of pointers, structures and dynamic memory allocation. Though assembly programming is also important, most MCU suppliers today provide C-callable functions for register level accesses so I don't suggest going into the nitty-gritties of MOV and ADD and all those assembly instructions you might need.As for application processors, it is great to know Linux fundamentals and concepts like boot-process of a processor, uboot, kernel, board ports and linux drivers. It is an added bonus to know stuff like shell programming for automating scripts and even generating your own boot extensions. Python (owing to its huge popularity and humongous application libraries) is an excellent prototyping language - I really don't know if it is the best choice but it will surely do the job.Please feel free to comment on my answer.

What function do we use in Java in place of cin>> in C++?

Java commands function much differently than C or C++.JAVA IS A PURELY OBJECT ORIENTED LANGUAGE!That being said, even the command that takes the input from the user has to be an object of a class. You'll get that as you study the basics of the language.Now, for your question:Suppose I want to take in the value of an int from the user.I declare integer as int a;After this, I define a Scanner class with object of any name(Here, S) and also declare it's function as System.in.Scanner S=new Scanner(System.in);Next, I equate my integer my integer 'a' to the nextInt() function of object S using dot operator:a=S.nextInt();Thus, C code for input is:int a;
scanf("%d",&a);
It's equivalent in JAVA is:int a;
Scanner S=new Scanner(System.in);
a=S.nextInt();
There are other ways too. This one is the easiest!HAPPY CODING!edit 1: Please remember to import util package before using Scanner class using the below command.import java.util.*;
The Scanner class of JAVA is available under this package and won’t work unless it is imported. Certain methods of JAVA need packages to be imported before using them.So your final code must look something like this:import java.util.*;
public class HelloWorld{
public static void main(String []args){
int a;
Scanner S=new Scanner(System.in);
a=S.nextInt();
System.out.println(a);
}
}

What is the difference between web development & web design?

The above image should give you a rough idea about what each classification of job under web development takes care of.Designing of a webpage takes care of it aesthetic and usability aspects of it. It's a designer's job to take of which color combination to use and how to keep the entire layout balanced. They also take care as to what part of the content has to be given importance and be presented to the user in a particular way and how the rest of the content has to be delivered.Designers are the one's who execute the initial steps towards website building. Generally, they create the layout​ on Photoshop during the initial stages and then dive into the front-end development section with the help of HTML, CSS et cetera.Web developer is more of regarding the functional aspects of the website. For example, if there are forms in your website then it's highly likely that the code that handles all the data is written by a backend developer. Developers take the input from designer and add further functionality related to programming side of it. There is basically no creativity and beautification of the website involved here.Ultimately, you can be a designer as well as a developer and still do a good job in creating websites. There are no strict rules to it.I hope the differences are clear to you now.Thanks.You can read a little more about the differences in the link below!Web Design or Web Development, What's The Difference?Image Credits : Google Images

Is The Jungle Book (2016) trying to make any political statements?

Not necessarily political, but Kipling was certainly a supporter of Anglo Imperialism and Mowgli can easily be seen as an outsider visitor to an exotic land who must come to a dominant position even while growing to appreciate the strange and amazing beauty of his adopted home.Some people claim that the King Louie sequence in the animated version is a mid century White American commentary on Black people wanting to be like White people and coveting their lives. It’s an interesting assertion, and given Disney’s own occasional expressions of racism against Blacks, it’s plausible even if the conclusions are by necessity subjective assessments.It seems more likely that rather than any intentional fealty to an agenda, Disney was simply a man of his times, and from our current point of view absurdly racist. His art may simply be reflecting the same casual racist viewpoint that the majority of Americans had at the time, where racism and stereotypes were “funny”.

TRENDING NEWS