Stanford Laptop Scientist Solutions Coding Questions From Twitter
Chris Piech, professor of pc science at Stanford College, solutions the web’s burning questions on coding. Do you wish to have to understand math to be excellent at coding? What number of pc languages are there? Are programming and coding the similar factor? How do you code A.I.? What’s the that means of the “404” error? Chris solutions these types of questions and a lot more!
Video Transcript
– Hello, I am Chris Piech.
I am a professor of Laptop Science at Stanford College.
Lately I will be answering your questions from Twitter.
That is Coding Give a boost to.
First up, from Mojam TXT, “What number of coding languages are there?”
Neatly, Mojam, there may be numerous coding languages.
Probably the most most well liked ones come with Python, that is nice if you are doing information science or if you are writing scripts to your pc.
There is Java Script that is nice if you are writing a web site.
And there is a complete bunch of alternative ones like C, C++, Java, and that is the reason simply 5 of the highest maximum not unusual ones.
My good friend from college even made a coding language of their very own only for amusing.
EugeneDaniel requested, “Can coding be self taught?”
Completely.
Coding is any such particular box.
What issues is that you’ve got the abilities.
It isn’t important such a lot you probably have a credential pronouncing you’ll be able to do it.
What issues is that you’ll be able to pick out up a pc and you’ll be able to code it and make it do superb issues.
There is numerous improbable assets available in the market.
Stanford, myself, we provide loose programming magnificence if you are .
I do know numerous self-taught good fortune tales.
Once I labored at Pixar, I knew numerous programmers there who had by no means even studied pc science in college or anything else like that.
They’d simply taught themselves, and now we are running at some of the coolest programming firms.
Ok, subsequent up.
Glacialicon, “I all the time puzzled in apocalyptic and motion motion pictures, how do coders set up to avoid wasting the day with out ever the usage of Stack Overflow?”
And Glacialicon, I am gonna say, that is an improbable query.
Realistically, after we’re coding, we are the usage of Stack Overflow.
Stack Overflow’s a web site the place you’ll be able to move ask questions and notice solutions and you’ll be able to see code snippets that other folks use to unravel issues.
Each and every critical coder I do know makes use of Stack Overflow to construct higher solutions.
And so it is beautiful unrealistic that during an motion film they are now not the usage of Stack Overflow.
Despite the fact that I assume in case you handiest have a couple of mins to avoid wasting the sector, possibly you must code with out getting any assist.
The foundation of the time period Stack Overflow is if truth be told an enchanting tale.
It comes from some of the issues that it’s essential to have whilst programming.
Your program has a specific amount of reminiscence.
A part of it is known as the stack, and if that stack makes use of an excessive amount of reminiscence, it throws a stack overflow error.
And this steadily occurs when there is something going truly fallacious along with your program, is simply eating reminiscence wildly.
However the Stack Overflow web site is not just about that downside.
It is a complete group the place other people come in combination and assist each and every different.
And I like that group of all people coming in combination and making each and every different higher.
R40aja40 asks, “What does entrance finish and again finish imply?”
I like this query.
And what?
To turn you, I would like to give an explanation for just a little bit of ways the web works.
Whilst you use a cell software, shall we say you are the usage of Google Maps, and Google Maps is telling you learn how to get from level A to indicate B, there may be a pc program that is working to your telephone and that is the reason known as the entrance finish.
However now not the entire paintings is finished to your telephone.
If truth be told, numerous the paintings may well be achieved on a special pc.
So what your telephone does is it connects over the web to every other pc that we name a server, and that pc can do calculations and ship the solution again for your telephone.
And , that is mainly the speculation of the web.
We now have these types of gadgets and they are chatting with different computer systems on other portions of the sector.
And systems that run in this pc pc, we name the ones the again finish.
So you’ve gotten the entrance finish working on issues that you just interface with, and again finish working on issues which are doing a little paintings in the back of the scenes that you would by no means see.
You recognize, possibly it is a little bit like a automotive.
The entrance finish may well be the steerage wheel.
That is what people have interaction with.
There is a complete bunch of generation there.
The again finish is the generation you do not see.
Perhaps it is just like the engine, it is doing truly necessary stuff, but if the whole lot’s running easily, you simply have interaction with that steerage wheel.
Some other people handiest concentrate on writing systems for the entrance finish.
Some other people handiest concentrate on writing systems for the again finish.
Or you could listen this time period “Complete Stack Engineer”, and the ones are programmers who can do each the entrance finish and the again finish, and that is the reason a excellent factor to be.
Subsequent query from Begusgasper, “What’s the shortest piece of code that modified the sector?”
That is a excellent query.
And over a drink we can have a really perfect dialog and debate this.
I am gonna say again propagation for synthetic intelligence.
Again propagation is the few strains of code that tells a synthetic intelligence set of rules, “If I see information, how can I transform smarter primarily based off of that information?”
It is a quite simple piece of code primarily based off some cool calculus, and that is the reason the place maximum AI will get its intelligence from.
Say your AI set of rules is attempting to be told what a cat is, and it sees an image of a cat, it will probably put it via its personal little AI mind.
Again propagation will inform it learn how to trade its AI mind in order that it’s higher in a position to know cats at some point.
Sudo_rbot does not truly have a query however a lovable little rhyme, “How a lot may a C plus plus if a C plus may plus plus?”
C++ is without doubt one of the most well liked programming languages.
If truth be told, it is the one who I first discovered on, that is how previous I’m, and C++ it is what you wish to have to make use of if you are writing a truly intense program like a three-D pc recreation or if you are writing this system to animate a Pixar film, C++ is what you would use.
C++ is if truth be told descendant of every other programming language known as C. And C is just like the grandfather of all languages, just like the Latin an identical from which many alternative languages lengthen.
C++ is a type of, and you’ll be able to see the place it were given its title from, it is C after which plus plus is programming speech for “one higher”.
So it is like, “I am like C, however I am just a little bit higher.”
And there may be different descendants you’ll have heard of like Java and Python.
And the truth that these types of 3 languages descend from C tells you the way equivalent that they’re to each other.
Why is C or C++ so excellent for online game programming?
As a result of it is so computationally intense.
It’s important to render a whole three-D international with bushes within the distance and issues animating within the entrance and that simply asks such a lot of your pc.
C and C++, they are like your naked bones programming languages.
They are the most productive so they are able to run the quickest, and they are able to do probably the most computations according to 2d.
Python and Java, they are more straightforward to learn, so it is more straightforward to jot down this system, however the pc can not run them as temporarily.
LosMerengues_14 asks, “My pc science trainer requested, ‘What’s Python?’
And I spoke back, ‘An overly bad snake.’
And he beat me up.”
I believe like we need to have a special dialog about corporal punishment right here.
Do you know the title Python, the title for this programming language, if truth be told comes from Monty Python’s Flying Circus?
The one that invented the programming language known as Python was once a large fan of the TV display, and so gave it that title.
It is a normal goal programming language.
So it’s essential to write a Google Maps backend on it.
You’ll want to write information science, it’s essential to simply write a script that does one thing amusing, or it’s essential to write a chatbot even.
Do you wanna see what Python looks as if?
I will be able to display you a truly fundamental intro to Python program, a “hi international” and print 10 numbers.
This is an instance of an easy Python program.
This says whilst you run this program, so someone is going to the pc and so they click on to your program, it will open up a console, and it is gonna say, “Hi international.”
That is the greeting we use after we are seeking to display that we will write our first program.
It is like your program pronouncing, “Hello, I am new to this international, inform me all about it.”
After which your program, in very cool model says, “I am gonna print the numbers, the primary 10 numbers,” so it’s going to print 0, then one, then two, then 3, then 4, then 5, then six, then seven, then 8, then 9.
Major is what occurs when someone begins your program.
So def major says, “When anyone begins your program, I am gonna execute all of those instructions,” after which I write the instructions separately.
The primary command I wrote is print “hi international”.
Print doesn’t suggest like print via your printer, it approach display up at the display screen.
The following line says, “for i in vary”.
One of the crucial good things about computer systems is that they are able to do a whole lot of repetitive duties with out turning into pissed off.
People, now not such a lot.
That is a type of fundamental instructions you wish to have to understand to make a pc repeat a role.
It says, “I wanna repeat one thing 10 occasions, and 10 occasions I want to print out a price.”
This can be a price that is gonna trade numbers from 0 up until 9.
So whilst you run this program, it’s going to print 0, then one, then two, then 3, then 4, then 5, then six, then seven, then 8, then 9.
Subsequent query from CheEsquire, “What’s the that means of error 404?”
Error 404 is what you notice whilst you move to a web site and that web site does not exist, and the webpage is pronouncing, “I do not know what web site you are in search of.”
Extra widely, when systems do not know what to do, or after they smash, they steadily throw a factor known as an error.
And as a human you are given those mistakes.
Mistakes all the time have codes, they inform the human, and so they inform someone who is seeking to diagnose what went fallacious, precisely what the issue was once.
So whilst you see error 404 that is a selected message pronouncing, “Precisely what went fallacious was once that I wasn’t in a position to seek out the specific URL you have been in search of.”
Internet error codes have been if truth be told outlined via the man who invented the internet, Tim Berners-Lee.
As I are aware of it, he was once simply bobbing up with sequential codes.
I feel the primary 4 approach that there’s a downside along with your webpage 401, 402, 403, 404, or simply other issues that might arise when you find yourself seeking to load a webpage.
Ok, subsequent query, Formulemur, “Are programming and coding the similar factor?”
Sure.
Coding is the method of opening up an software to your pc and writing a chain of a instructions that glance so much like English, however are in a selected language that your pc can perceive.
You’ll code in one thing like Python or JavaScript.
Those are the languages of coding, and that is the reason the way you inform a pc, “I need you to accomplish these types of movements when someone hits a button, or when someone opens this software.”
Programming is the very same factor.
You make a program when you find yourself coding.
FutureLear, “What’s Raspberry Pi and what can be utilized for?
FutureLear, it is a Raspberry Pi.
And this is without doubt one of the international’s least expensive computer systems.
What are we having a look at right here?
We are having a look at a small model of a motherboard, and on it it has issues that you’ll be able to plug in like a USB.
It has a spot for audio and a spot for web connection.
And at the chip it has a factor known as a CPU, so it is central processing unit, so it will probably procedure systems, and it has some area for reminiscence, so it will probably retailer some information.
It could connect with an influence supply, it will connect with a track, and it will probably connect with a whole lot of sensors.
And why is it so cool?
Shall we say you sought after to jot down a program however you sought after to make it bodily and have interaction in the true international.
Perhaps you sought after to make a robotic, or possibly you sought after to make a wise doorbell or one thing like that.
You’ll want to use this tremendous reasonable programmable pc and possibly you set a sensor in it, and possibly you are making every other actuator, after which you are making one thing occur in the true international.
Subsequent query from TJ_Jesse_TJ, “How do you code AI?”
Wow, what a deep, deep query in so few phrases.
Other folks may well be questioning what AI approach.
AI stands for synthetic intelligence, and synthetic intelligence is an overly large time period.
It actually approach any set of rules which is performing in an clever manner.
The commonest form of synthetic intelligence is a sort known as device studying.
And that’s the reason when an set of rules will get smarter, when it seems to be at information, or when it will get stories of its personal.
The commonest method to code AI is in Python.
The usage of one thing like PyTorch or TensorFlow, you assert, “This is the construction of my synthetic intelligence community, and as soon as I’ve that construction I am gonna write some code that may soak up information and I will inform my synthetic intelligence to get smarter the usage of information.”
And that’s the reason all achieved in Python.
However in 2022, the best way other people write AI may well be converting.
There are those truly massive synthetic intelligence networks that have been revealed, and occasionally writing AI is determining learn how to communicate to those truly billion-parameter neural networks.
So you’ll be able to installed activates that may provide you with attention-grabbing solutions.
KukielkaMaciej requested, “Do you observe algorithms incessantly?
If sure, why?”
I do observe algorithms incessantly.
I observe algorithms incessantly for a lot of causes.
One, as a result of they are neat, one as a result of I educate them, one as a result of they maintain me turning into a really perfect programmer, but additionally as a result of we invent algorithms.
However what is an set of rules?
An set of rules is mainly any piece of code that does an enchanting job.
So possibly it solves an issue that may take numerous idea.
One instance of one thing we labored on just lately is we made an set of rules that may do a virtual eye take a look at, and it is all the time being considerate about what dimension letter to turn someone subsequent.
One set of rules you could listen so much about is just like the TikTok set of rules.
What that does is it makes a decision what video you must see subsequent.
How does it paintings?
That is if truth be told a little bit of a thriller.
I do not believe they inform the sector, “That is how our set of rules works,” but if other people say the TikTok set of rules, what they are speaking about is how TikTok chooses that subsequent video.
Antom asks, “GitHub, what the hell is GitHub?
It sounds impolite.”
GitHub’s now not impolite, GitHub’s your good friend.
GitHub is a web site the place numerous us host our code.
So once I write a program, steadily I am running with other folks and we use GitHub to retailer our code.
So much like the usage of Google Medical doctors for when you find yourself running on a Phrase record in combination, GitHub’s our position for code.
Additionally it is a spot the place you’ll be able to move and notice other folks’s code.
Some other people make a selection to place their code up publicly which means that that once I am running on a undertaking, I will be able to see what other folks have achieved.
That is some of the cool issues about pc science.
We are all the time development on most sensible of one another’s concepts.
So if someone’s constructed a truly cool program, I would not have to begin from scratch off and I will be able to construct a most sensible in their truly cool program.
Subsequent up from NanaouuSymeon, “Which coding language is the perfect one?”
That is a excellent query.
What we educate intro pc science at Stanford, we use Python as a result of we predict it is the maximum delicate advent to programming.
However in the first actual week we use an excellent more effective programming language known as Carol.
That is Carol.
Carol’s a easy robotic.
Carol can handiest transfer, flip left, put down a beeper, or pick out up a beeper.
However whilst you upload in one of the crucial fundamental keep an eye on go with the flow of programming, Carol can do anything else that we will do in Python, which is improbable.
We use as a gradual advent simply to turn you the fundamentals, and it is a good way to be told In case you are curious.
Diners asks, “Do you must be excellent at math to code?
I lowkey wanna be informed however I am horrible at math?
Do it.
Discover ways to code.
You do not wish to be nice at math to code.
This can be a not unusual false impression.
I feel it has its historic roots in the truth that when programming was once first invented, they did not know the place to place it within the college, and so they took place to place it within the math division.
So other people suppose you must be nice at math, however if truth be told I have noticed such a lot of superb programmers who do not really feel that assured in math.
And what?
Discover ways to program, it’s going to most definitely assist your math out, as it is helping you do a whole lot of issues that use common sense, and math is one instance of one thing that might use some common sense.
I would say what abilities do you truly wanna have in case you wanna discover ways to program?
The need to construct issues, ‘motive programming is all about making stuff, and endurance, as a result of occasionally when you find yourself making issues, it may not figure out the best way you anticipated.
And if you are affected person and you are prepared to paintings via step-by-step, you’ll be able to determine it out.
Banqash1401, “I’ve all the time been curious in regards to the foundation of coding, pc tool, synthetic intelligence.
My questions have been like, ‘How scientists can have bridged {hardware} with tool for the primary time?
What was once their imply to try this, and when did they understand that any such factor may well be imaginable?'”
Oh, the historical past is so attention-grabbing, and it performs into such a lot of necessary portions of human historical past.
Surely some of the turning issues was once International Conflict II.
When Alan Turing and a bunch of other folks in the United Kingdom, got here up with what some other people would imagine the primary pc.
Why?
In order that they may decrypt German messages that they have been sending between each and every different.
And also you wanted to check out an entire bunch of various secret keys in case you sought after to decrypt it.
They constructed what I might imagine of some of the first computer systems, and would check out rather a lot and a whole lot of other keys till it will decrypt the German messages.
You’ll want to recall to mind this as some of the first items of synthetic intelligence, as a result of cracking anyone else’s code, that sounds so much like intelligence.
However the historical past of tool is going manner prior to that.
Other folks have been theorizing that it’s essential to have one thing like a pc again, again within the day.
Within the 1800s, Ada Lovelace and every other professor, Charles Babbage, they have been pronouncing, “I feel we can have computer systems that paintings on virtual ones and zeros, and if truth be told, these items may clear up issues.”
And Ada Lovelace, with out even having a pc, began writing these types of other algorithms and systems when computer systems did not even exist.
They usually roughly confirmed the sector, “That is gonna be cool as soon as we’ve the electronics for it.”
Nihar_dm asks, “Is coding required for internet design?”
What is internet design?
Internet design is when you are making a web site, and that may steadily contain coding.
It seems numerous the internet sites you have interaction with, they are working numerous attention-grabbing code beneath the hood.
What occurs whilst you click on this button?
What I fill on this shape, what is intended to happen subsequent?
And other people write that during a coding language.
Having mentioned that, a large a part of a internet design workforce could also be artists.
Other folks simply considering, “How can I make this a gorgeous web site?”
Or, “How can I make this a gorgeous consumer enjoy?”
And it is a truly treasured ability to discover ways to transform that artist or that consumer enjoy dressmaker.
You do not essentially want coding for that.
PrettyHatHacker requested, “The actual query is, ‘Do you wish to have to understand how to code with the intention to hack?’
Why or why now not?”
We must smash down what hack approach, ‘motive it approach various things to other other people.
To a couple other people, hacking approach breaking into anyone’s web site or one thing like that, possibly coming into a database, stealing some passwords.
In my box, we if truth be told name that cracking, and that is the reason relatively unlawful and I would not counsel other people do this.
Hacking on the planet of pc science occasionally is a shorthand for writing truly spectacular code.
Irrespective of which model you are doing, the unlawful model or the fewer unlawful model, if you wish to be doing truly attention-grabbing issues with computer systems that possibly move towards the grain, for sure figuring out learn how to code is necessary.
Do not do anything else unlawful at house.
Jerry_Bandito, “Why is coding necessary?”
Coding is the way you get computer systems to do issues for you.
So the power to keep in touch with computer systems is simply any such robust instrument to have.
Whether or not you are doing information science, or you are in coverage, or you are in artwork, it doesn’t matter what you are doing, there may be most definitely a time when your occupation would have the benefit of having the ability to talk the language of computer systems.
However I additionally suppose coding is not just helpful, it is also gorgeous.
This can be a truly gorgeous procedure of ways you talk to the pc, the way you create issues out of not anything.
When I am coding, I take concepts in my thoughts and I cause them to into fact.
Every now and then that is helpful, and occasionally it is only a gorgeous procedure.
Ok, that is the entire questions.
Hope you discovered one thing, until subsequent time.
https://information.yahoo.com/stanford-computer-scientist-answers-coding-160000263.html