Workshop · 2024-09-12

Learn to code using AI

Sahil Lavingia · · Gumroad

Sahil Lavingia is the founder of Gumroad.

In this session Sahil will go through how you can use AI to learn to code.

We'll cover the basics, tools you can use, general principles you must understand and showcase some examples.

Summary

Here's a cheatsheet i made from the call.

In this episode, I chat with Sahil, CEO of Gumroad, about the transformative impact of AI on coding.

00:00 Introduction to Sahil and Gumroad
00:23 Debate: Code vs No Code
01:04 The Evolution of Coding with AI
02:49 Sahil's Journey and Gumroad's Products
05:51 The Impact of AI on Work and Innovation
20:28 Learning to Code: Fundamentals and Perspective
43:18 Understanding Multiplication
46:54 Introduction to Algebra
47:13 Basic Math Exercises
51:28 Exploring Variables and Loops
58:12 Data Structures and Algorithms
01:01:02 Prisoner's Dilemma Explained
01:08:28 Building a GPA Calculator
01:20:24 Exploring the Composer Feature
01:20:41 Writing a Python Script for GPA Calculation
01:23:13 Running and Testing the GPA Calculator
01:25:18 Understanding the Code
01:31:57 Enhancing the GPA Calculator with HTML and JavaScript
01:37:39 The Role of AI in Learning and Coding
01:41:51 Addressing Hallucinations in AI
01:47:28 The Future of Software Engineering and AI
01:53:37 Final Thoughts and Advice

Transcript

[00:00:00] Ben: Today we're gonna basically talk with Sahil who is the CEO of Gumroad. I'll let him give a bit more of an intro on himself for those who don't know him. And then the general theme today is like learning to code with AI.

[00:00:12] Ben: Um, I'm very much not a coder and actually Sahil was an investor in my no code education startup, um, a few years ago now, 2019 or something it was. Um, and we had this debate actually on the Indie Hackers podcast, like code versus no code. And I think we both came away with like, Actually, we're both right, whatever tool it is that helps you do the thing, use that tool.

[00:00:39] Ben: Um, and I still think no code, the theme of no code was correct, but now it's like using AI to write the code. So whether that is That's probably somewhere right in the middle of our debate that we had. Um, but yeah, but if you want to give an intro, Sile, and uh, you can sort of start playing around.

[00:01:03] Sahil: Yeah. I mean, I agree.

[00:01:04] Sahil: Uh, we, you know, I think where we're at now, uh, with Cursor and Clod and all this stuff is kind of the best of both worlds, right? Because it's, it's no code in the sense that I'm not the one writing the code. Uh, but it's code in the sense that if there's a bug or there's something you want to change. You have full access to the code as if you had written all of it.

[00:01:26] Sahil: Uh, which is really nice because at the end of the day, the core complaint often with no code is that is the constraints of it, right? You just can't, if you build something with a web flow and you want to do something that, Like you want to pull in data from your database and put it on Webflow, that all of a sudden becomes like a pretty convoluted way of doing that.

[00:01:45] Sahil: And you have to effectively be a software engineer, like looking up, creating an API, pulling in, and having JSON, you know, figuring out JSON, blah, blah, blah. Like there's a lot of complexity to that. Um, and so I feel like if you're able to build a Webflow like, like in a, in a similar way, you can [00:02:00] like effectively get all of the benefits of code with the speed and agility.

[00:02:04] Sahil: Um, and dynamism that you get with no code, because no code is really awesome because it allows you to build so fast, but also it allows you to experiment really quickly, right? Uh, it's hard to experiment with coding because it's so expensive, so time consuming to build everything. So you want to kind of like figure everything out first.

[00:02:21] Sahil: Uh, and now I feel like we live in a different world where actually it, it makes more sense often to experiment in code directly. Uh, And we, we've started to find that, like, we've started to skip a lot of our processes, uh, in terms of design, Figma, design system, we just go, like the designers go straight to code, uh, we're not starting to go, they're still thinking in their head, but they're going from like notebook to code instead of notebook to Figma to code or whatever.

[00:02:49] Sahil: Um, and then, yeah, so my intro, I'm, my name is Sawhill. Um, I'm the founder of Gumroad. Uh, Gumroad's a company I started in 2011. I built it myself over a weekend. Uh, the, the source code is public actually. So if you just Google Gumroad v1, it's on GitHub. Uh, you could even probably take, ask cursor and maybe, uh, maybe we'll do this at some point, but, uh, you could just literally ask cursor to like rewrite it in the modern tech framework and it would probably do it.

[00:03:15] Sahil: Uh, so you could have your own version of Gumroad before we open source our version of it, which we plan to do next year. Uh, and then we have a few other products we've been working on Flexile for giving, uh, freelancers equity helper, uh, helper. ai, which is a customer support tool with like an AI first approach and, uh, and iffy.

[00:03:33] Sahil: com, which is basically a bouncer as a service, like a way to basically moderate the usage of your website in a very automated way so that you can effectively run like a marketplace or a UGC website without having to deal with like spam and fraud. I see. Terrorists and child, whatever, uh, you know, uh, people who have bad intent, uh, legal or illegal things that you don't want to support.

[00:03:56] Sahil: We make it really easy to like, basically act as a bouncer around your [00:04:00] entire application. Uh, and so those are four products that we now work on as a company. Uh, and we hope to have more in the future powered all by AI. And that's, uh, it fits really nicely into that. So I'm very excited to talk about how AI has helped us.

[00:04:14] Sahil: sort of ship, ship a lot more stuff a lot faster, give you some examples. And then ideally start from scratch and like build something very, very basic and new so people can get familiar with like the beginning of how to learn to code. Cause I still think coding is essential. I think, you know, I think like the, the best, uh, the best people will always be those who are, who know what's actually happening at the end of the day.

[00:04:32] Sahil: So.

[00:04:34] Ben: Yeah. I think that's, that's the big thing that I'm taking away from this whole wave of. AI writing the code so you don't need to know how to write code, but Understanding what the code does like you said if you hit bugs want to add specific features and like there's something You want to do that?

[00:04:51] Ben: You need to understand the pieces Together like what they do and what's touching what and what's like connected? Um, and I think that's way easier now than it ever was because you can just literally ask what is this thing doing here? um, and that's You Yeah, that's just something that wasn't available when I was trying to build stuff And the reason it we went straight to no code stuff was like that's the only way I can build I can drag stuff around And get something up there.

[00:05:19] Ben: Um, and then we're hitting all sorts of limitations on What no code can do and I think everyone will get to a point where that is the case if you build Strictly on no code tools Um, yeah, and I think now is the best, best time ever to be like, okay, well, let me drop the whole no code is persona type thing and embrace the fact that code is more accessible than ever and easier to write than ever.

[00:05:47] Ben: Um, so yeah, I'm excited to see what we can get done in this session. Um, yeah, I don't know if you want to kick off with, Kind of what we were speaking about before we hit live here, um, [00:06:00] with how you sort of transitioned from being, being a bit more of a manager of Gumroad as the company and organizing. I remember you talking about how, how you work and you've got this icebox stuff and you had like, this is how we hire.

[00:06:15] Ben: And you had loads of that kind of documentation out there and you were really like, It felt like you were building the organization piece rather than, um, like building products. So yeah, I want to start there.

[00:06:29] Sahil: Yeah, let's start there. Yeah. Yeah. I mean, I think, you know, everyone goes through this transition.

[00:06:33] Sahil: It's sort of, uh, the, you work, you go from working for the business to working on the business. And this is generally seen as a really good thing because it's like the sort of. It's leverage, right? Instead of being like the baker, you hire people to bake for you. And then you spend your time doing marketing, management, sales, uh, biz ops, legal, whatever, right.

[00:06:54] Sahil: All these other things. Uh, but, uh, what that tends to mean too, is that you, your bakery stops innovating, right? Like you, you now have a bakery that is able to like bake the same cake, like a hundred times faster than you individually would be able to do that. But if you want to keep innovating, if you want to keep coming up with new ideas.

[00:07:13] Sahil: You need to kind of stay in the kitchen, right? You need to, you need to be there, uh, coming up with new ideas, trying out new stuff, not just because you can do it and maybe the team can't. Uh, it's more so that, you know, and this is kind of this mean that it came on Twitter the last couple of weeks around founder mode, but to come up with really radical ideas, you kind of need to not be fired in a way, right?

[00:07:36] Sahil: Like you need to be a founder, whether it was a founder or founder, someone who basically has like. It's sort of God mode turned on for them. They can kind of just do whatever they want because often like embracing the future, embracing, like building a totally new thing requires saying, Hey, all this stuff we've done is useless, you know, and that like, what team member is going to, is going to do that.

[00:07:56] Sahil: Right. Like what team member is going to say, Hey, by the way, the work that this team does, like [00:08:00] if we make this simple change, we can like fire that team. Like, that's not what, that's not what team members do. Right. No one, no one wants to like throw their friends under the bus in that way. So the only, only person in the company and it's tough, it's a lot of work too.

[00:08:13] Sahil: Right. So the only, the only people who really are benefiting from it the most are the investors, the investors in Airbnb benefit from founder mode and the customers benefit the most from founder mode. The employees benefit the least in the short term from founder mode, right. Which is why it took so long to like write that article and why it was so contentious is it's quite literally anti employee.

[00:08:31] Sahil: Right. Uh, which is totally fine because we were in a ZURP. ZURP was very pro employee, it was very easy and friendly, and you could work remote, and it was all offline and flexible, and now we have 5 percent interest rates, and now you have to like fucking prove yourself, and you have to be providing value to shareholders.

[00:08:46] Sahil: Uh, and if you can't do that, totally fine, you have to get a new job, you can't, you can't do that here at this company. Uh, and what I love about running Gumroad is I've sort of been in every, I think of, there's these three stakeholders, there's like investors, and I can maybe even draw this out, now I have an office.

[00:09:05] Sahil: So back then we didn't have an office. This is a new, a new thing. Uh, but if you, if you think about the three, the three stakeholders in a company, arguably there's four, but, you know, you have like your investors over here. Your team and your customers. This is how I think about it anyway. Right. So you have like, and you, and like, you basically have to pick where you are in who you are currently, basically.

[00:09:38] Sahil: Like, you know, if you're like an ideal person, you might say you're in the middle, right? You're perfectly in the middle. You're perfectly managing your, you know, the investors cost benefits, the customers cost benefits and the team's cost benefits. Uh, but really what happens is Zurb. Basically means that you care like Zurb meant that investors you could kind of disregard and you could [00:10:00] just focus on basically like over here, like Zurb basically pushed this dot, you know, that was over here.

[00:10:09] Sahil: Over here, right? All of a sudden you're, you're, you're trying to optimize for these guys. Um, now we're kind of in a place with AI when like founder mode is like over here, this is like founder mode right here. Which personally I still think is great for the team because they have to, they get to learn, they get to do more cool stuff, they get to upskill.

[00:10:30] Sahil: But most teams would not opt for that without it being forced on them, right? Like Steph Curry is not really interested in playing basketball if they're number one and they have no threat. What creates the drive to change, uh, from star performers is threats from other companies. Uh, and so that's like founder, founder mode is just like, Hey, basically everyone is fired unless we adapt.

[00:10:53] Sahil: And then everyone gets rehired in this new role in this new way. Um, but no one should think like, I think right now we live in this world in which people look at AI as something that could potentially unemploy them. And so they're kind of scared of that. Uh, but the truth is like, if they don't change, they are, you have to assume you're unemployed here.

[00:11:10] Sahil: Like your, your, your, your job is over in three months. Your, your, your current job is done. Well, okay, if that's true, then what do you do over the next three months? You have to find a new job. And so that's basically what everyone's been doing at Gumroad, including myself, um, is trying to find a new job within this new, totally crazy world, uh, that we're in.

[00:11:28] Sahil: Uh, and that mostly means actually, ironically, in the context of this, like a lot of people think coding is going away or soft engineering is going away, but I see it exactly the opposite, which is actually like, it's more essential than ever. Uh, because If you can use the cursor to code 10 times, 20 times faster, then all of a sudden, like, you become 10 to 20 times more valuable to the company.

[00:11:52] Sahil: Right. So it's a lot better. So, um,

[00:11:56] Ben: so anyway,

[00:11:57] Sahil: that's it.

[00:11:58] Ben: With [00:12:00] founder mode stuff. It's obviously like contextual as well. So like the example being Brian Chesky. He had obviously a massive company, public company, and then decided to go founder mode effectively. And that then threatens the team more in, in what you're saying than how you've done it, for example, like how I've done it, or how a small company starts off as founders.

[00:12:24] Ben: And it's just like, we're just this kind of style company. Where this many on the team, it kind of naturally is founder mode until a point where it's like 2050 people or whatever. So it's always like, yeah, I think early startup employees.

[00:12:42] Sahil: Yeah, it always starts out founder mode, but then eventually you basically just get lazy, right?

[00:12:46] Sahil: You're like, you live in Zerk long enough. You do, your company is growing fast enough. You basically just get kind of lazy. Because you're like, do I really want to like get works 12 hours a day, like trying to get my team to work 12 hours a day? Like, no, not really. You know? And like if Airbnb's still growing really fast, like it's, maybe it's fine if the designers are only working like two to three hours a day, right?

[00:13:08] Sahil: Um, but now I'm like, no, it's not, that's not acceptable. Like everyone needs to be pushing like a filthy amount of, of stuff to production. Otherwise I, I can do it myself. I can just do it myself, you know, at the end of the day. So like, why would I hire someone else to do what I can do? Right before, before cursor, I'd have to type the code and like I couldn't physically type 30, 000 lines of code a week, which is how much we ship.

[00:13:36] Sahil: But with cursor I can do that I can do 30, 000 lines of code a day. Right. So, the bottleneck is that now you actually have to come up with new ideas. Because now it's not the lines of code that matter. It's actually like how many features you can think of and implement and ship. Uh, that stuff that I, I, my brain will still run out of energy doing right.

[00:13:56] Sahil: Uh, but basically I think everyone gets a promotion, right? Like, [00:14:00] like you kind of, you can kind of assume that everyone at the bottom of the ladder is fired. Right. Uh, and now you only effectively, if the people who are left are the managers, but the managers now, because they're at the bottom are now individual contributors again.

[00:14:14] Sahil: So you can imagine, like for example, in the context of of customer support, you can kind of assume that if you're doing customer support, you are out of a job. The people who are now gonna do customer support are the customer support managers who are now doing customer support. They may be managing the aid AI agents, but they are the, now the, the ones who are now interfacing directly with the, with, with the customers, right?

[00:14:37] Sahil: Uh, same thing. Designers are all fired designers now. Everyone is a design. All the design managers are now designers. Right. And this basically is what founder mode is, is effectively you fired everybody such that the CEO is now doing customer support is now doing design is now doing engineering, like, there's, there's nothing, there's no layers under that.

[00:14:56] Sahil: And so you have to just be really fucking good basically right because you have to be able to provide so much value to the company that like, you know, you're still, you've still found a role. And you're certainly right like the smaller the company, the easier it is. Because, you know, it's just, it's just less, less, less, uh, it's, it's harder to like create, you know, to like hide basically.

[00:15:16] Sahil: Right. Um, but yeah, the way, the way that we've been working on Gumroad, I think is, is, is just so well situated for this stuff, because as I wrote about, like, we, we have two full time employees, me and Connor over there. And, uh, then we have 30 part time hourly, uh, contractors, hourly freelancers. Um, and I can basically tell them, Hey, if you embrace AI, your hourly rate goes up 25%.

[00:15:37] Sahil: Right. By the end of the year, because you're, you're shipping five times more. I can pay 25 percent more for five times more product. Like that's an easy economics trade. Right. Um, but if you're not willing to do that, then I could pay you zero, right? Your, your hourly rate goes down a hundred percent. Uh, so like what, you know, you can, you can, what, what side of that do you want to be on is completely your choice, right?

[00:15:59] Sahil: [00:16:00] I mean, I don't, I don't, I don't think people want, love what like should be working until the end of time. So eventually, like eventually everyone will choose to opt out of the system. Eventually. And that's also totally fine because we have a system in which we give everyone equity and dividends. And so the whole point is that you shouldn't be automating yourself out of a job.

[00:16:19] Sahil: You build up an equity position in the company and then you're getting paid to do nothing. You're getting dividends, right? Like if I don't work this year, I still get paid dividends, right? Uh, if I want to get more dividends, I have to work really hard to increase the dividend pool. Uh, via, you know, more profits to the company.

[00:16:37] Sahil: Um, but so I think, but, but I think that, that sort of is also part of this thing that people aren't really talking about is you have to incentivize the adoption of AI, it can't just be a pure story narrative of like, AI is awesome and cool. Um, it's like, well, how do, how do, can I make more money because of AI?

[00:16:53] Sahil: Um, otherwise why would laborers be interested? Right. Labor is like, all they get is more work and they get paid the same amount of money for doing more work. That's not. That's not, that's not what most people would, would want. Right. Uh, so I think it's sort of the incentives also have to kind of be updated.

[00:17:11] Sahil: Um, and we've already updated them because I kind of saw the writing on the wall a couple of years ago and, uh, and now it's finally kind of, I feel like really coming to, to a head. So it's, it's really fun, fun to be a part of.

[00:17:23] Ben: Yeah. It's interesting that how AI affecting work and jobs. It's naturally going to have maybe not even second order effects, but first order effects on the organization and actual company structure.

[00:17:37] Ben: So if we're, if everyone's losing their jobs, unless you're an IC and you're going to be able to use code, let's get into that piece.

[00:17:46] Sahil: You'll lose your job if you want to, like the whole idea of losing jobs because of AI is it just sort of assumes that you're, you're doing nothing about it, right? Like if you do nothing, it's kind of like you see a tsunami coming.[00:18:00]

[00:18:01] Sahil: Like, yeah, if you just sit on the beach and do nothing, then the tsunami will kill you. Uh, but if you say, Hey, I can like get a surfboard and start serving this thing, uh, or I can just move to that other beach in which, you know, like, like there's, there's many ways to, I think people just basically like remove the agency piece from these conversations and agency is what means people will not be unemployed though.

[00:18:24] Sahil: They're, you know, people will not like, Hey, I will not be doing all of our jobs. Um, because that's that's what humans want to earn money and, uh, and we'll continue to find ways in order to do that, right, whether it's through public policy, whether it's through social welfare, whether it's through creating new avenues for space tourism.

[00:18:44] Sahil: Uh, but there's going to be a lot of options opportunities to continue to earn money in this world. I mean, I just look outside. Uh, and there's a big there's Manhattan on the other side of the river, and I just see all sorts of. Innovation waiting to be had that, like, if government goes to zero, I could get a new job tomorrow doing 50, 000 different things, automating stuff, making things faster, more efficient, making it easier to send data back and forth different people.

[00:19:12] Sahil: So they have the same information, whether certain decisions, uh, you know, all sorts of of innovation around construction, supply chain, transportation, public policy, law, finance. Uh, it just really, uh, trillions and trillions of dollars of value that can be generated, um, So I'm, I'm, yeah, I don't think anyone should be that scared.

[00:19:33] Sahil: The only people who should be really scared are the people who, like, uh, you know, they're, like, doing something so, uh, rope, uh, you know, like, completely robotic, uh, in their, in their job and those, and they just enjoy it. They, they just love being a robot. Cause if you love being a robot, like if you love being a Starbucks barista, then yeah, like you're, you can basically not do that anymore.

[00:19:56] Sahil: Right. Like in the future, people will go to Renaissance fairs where people will dress [00:20:00] up as, as baristas and like take your order because like that is not a real creative job. Right. But who, like what I found is no one is that like, no one likes that. Everyone wants a more creative job. It's just that there aren't enough of them.

[00:20:14] Sahil: So hopefully AI creates more creative jobs. And, uh, actually more people will be happier instead of in some job they don't like, you know,

[00:20:24] Ben: yeah, no, I, I, I buy into that. Um, cool. So should we jump into some learning how to code with?

Yeah, let's do it. Should I start sharing my

[00:20:35] Sahil: screen?

Yeah, sounds good. Awesome.

[00:20:40] Sahil: Let's see.

[00:20:46] Sahil: Let's see if you guys can see this.

[00:20:48] Ben: Yeah.

[00:20:49] Sahil: Awesome. So yeah, I mean this is like basically this tweet that I had the other day that's probably a little pithy and, you know, not, uh, not, I would probably rewrite it if I spent more than five seconds thinking about it. Uh, but I, I, I, I think it's roughly true, which is, I think this, like before you learn how to code, I think it's sort of important to have some like.

[00:21:11] Sahil: Fundamentals, quote unquote, right? So, for example, if you want to learn how to draw a nose or something like that, uh, you're going to want to know some perspective, right? So that's a really quick. If you want to learn how to draw, you have to learn perspective, right? And there's. perspective, and then we'll get into some math.

[00:21:37] Sahil: I know people love math, so we're going to do that. One point, two point, and three point perspective. Uh, and what is this? What is, what are these, uh, these things? It's basically a way of Right now this is flat, right? There's a flat piece of paper affected, uh, but [00:22:00] if I'm trying to communicate something in real life, real life is 3D.

[00:22:03] Sahil: So I have to basically somehow take the world, which is in 3D, and transmute it into a flat surface, right? And the way we do that is with this concept of perspective. Perspective is one point, two point, and three point. The easiest being one point, so let's start there. One point would be like, imagine you're looking at a road, right?

[00:22:21] Sahil: How do you draw this road with like, let's say, traffic lights or something, right? So what does a road look like? Often looks like that, goes into the background, you know, has like things like this, and then it has, you know, street lights on either side. And then, you know, again, sort of smaller as you go. Uh, kind of like that, right?

[00:22:50] Sahil: And that's one point in perspective, right? Can

[00:22:52] Ben: you, uh, can you stop sharing your screen so people can see the whiteboard? Oh,

[00:22:56] Sahil: yeah, uh, yeah, that's fair. Yeah, you can't see it. I'll probably have to go back and forth a lot. So this is one point, right? You draw a dot, and you draw all these lines to it, and then you use the lines to basically draw things in perspective.

[00:23:13] Sahil: Blah, blah, blah, blah, blah. And there's some math in here if you want to do, like, for example, the, the, the second spot, the second, like, the, the sort of midpoint between these two traffic lights. Will be here to here and here to here, and then you see where they intersect. So, intuitively to your brain, you'd think, like, the traffic, the next 1 should be over here, but actually should be all the way over here.

[00:23:37] Sahil: So, anyway. 1 point perspective, then you have 2 point perspective. So, imagine. You draw 2 points. And now all of a sudden, you know, let's say you have a building, right? You now can do two point perspective,

[00:23:57] Sahil: right? You now have like a cityscape or, [00:24:00] or whatever. Right. Uh, and then three point,

[00:24:09] Sahil: you have three points, who'd have thought, right? So imagine, and this one's hard, it's getting harder and harder. I mean, it's not easy stuff. So let me see if I can even pull this off. Uh, but imagine lines coming out from each of each of these,

[00:24:33] Sahil: and then you can effectively use this. To draw

[00:24:49] Sahil: something like that. Draw a box. So, something like this. You now have a box. Like that. Something like, I don't know. See, it's hard. But, it should be more like this. So anyway, you have to use these lines and you're able to draw the boxes in 3D, right? But, the only way you can draw is if you actually understand Like the fundamentals of like the constraints of the system you're working within.

[00:25:20] Sahil: Right? Uh, and so coding is basically like that. Coding is basically like flat. It's 2D. You can't do anything you want. Like, for example, no one's going to say, Hey, build me GTA six and cursor, right? You just instinctively know that for whatever reason, the, the, the, the, the software doesn't have that level of capability.

[00:25:38] Sahil: So it's somewhere in between making a game of snake and making a game of GTA six. But where, where is that? Right? Where, where does that, where is that line? And that's kind of what I wanted to kind of talk a lot about today. So the first thing that I said was math up to algebra. Um, I'm going to skip statistics and probability.

[00:25:56] Sahil: I'm just going to talk about math, data structures, and algorithms. [00:26:00] Uh, and then I'm going to talk about, uh, I'm going to talk about the fundamental programming conditionals. I'll, I'll write all this stuff too. Uh, And then we're going to build our first app, which is going to be a GPA calculator, uh, GPA calculator, uh, for kids who don't know what a GPA is your grade point average, but basically when you apply to college, you give them a number, your GPA, right?

[00:26:26] Sahil: You're 3. 8 or 4. 2 or 1. 9. And the way that's calculated is basically you have classes, you get grades for each class. And then those grades turn into numbers. And then you do some very, very basic math algebra in order to come up with your GPA. And so the first thing I ever coded was a GPA calculator. Um, I built it in Excel at first, and then I wrote a Python script that automated that.

[00:26:54] Sahil: Uh, and then, so basically that's what we're going to do. And then we're going to actually use HTML, CSS and build like, and JavaScript and actually build like a GPA calculator website. Um, And it's super basic, but I think it'll give people a lot of the, the fundamentals. Uh, so just to recap what we're going to cover, we're going to do math up to algebra.

[00:27:22] Sahil: We're going to do data structures and algorithms,

[00:27:33] Sahil: and we're going to do variables, loops, and conditionals. And if you can do this, this is like 1. 2 point and 3 point perspective. Like once you know 1. 2 point, 3 point perspective, like once you know how to draw a box, Like, you know how [00:28:00] to draw a box, because you know 1. 2, 2. 3 point perspective, then all of a sudden you can draw someone's face, because you know that their face, you know, has, is split into thirds, you know that their brow line comes out here, you know that their nose comes down to the second point, you know that there's this here,

[00:28:33] Sahil: all of a sudden you can draw,

[00:28:39] Sahil: you know their ear is going to be around here somewhere,

[00:28:45] Sahil: all of a sudden you can draw. I'm not very good. But, you know, you get the fundamentals of what you're trying to do, and then you can do anything, and any, any amazing artist, uh, that's what they do, uh, and so math is gonna be point one, one point per second, two point per second, they're more respective, and we should be able to build a GPA calculator, uh, and, and it's gonna be awesome, uh, but this is, this is like the, the, the medicine before we have fun, you know, I want people to actually do the hard stuff, this is the hard stuff, the easy stuff is the hard stuff, ironically.

[00:29:18] Sahil: Uh, like drawing a box, just draw like 5, 000 boxes, right? Basically, it's, you think it's easy, but it's hard. Uh, so math, what's the, like, and we're literally going to do math from zero to algebra, okay? Uh, and, uh, and so we're going to start there. What is the first thing you learn in math? What is, what is the, like, what is the, what is the world that math lives in?

[00:29:42] Sahil: It's numbers, right? Uh, and so all numbers live on a number line. Okay.

[00:29:50] Sahil: And what's the first number? I mean, it's in the word first, it's one, because humans came up with the number one before they came up with the number zero. The number zero was [00:30:00] invented or discovered very, very late, uh, in human history. Uh, it's called algebra because it's an Arabic invention, actually, not Roman, Roman numerals, Roman numerals.

[00:30:11] Sahil: If you think about Roman numerals, uh, it's this, right?

[00:30:19] Sahil: So Romans, this is This is counting, right? They didn't figure out zero. Uh, they, the Arabs figured that out, and that created ten, and that created ten times ten, and all of a sudden you can do multiplication and get ten times ten equals a hundred, and think about how long it would take you to count to a hundred with this methodology.

[00:30:45] Sahil: I don't even know how to do it. Like v1, v11, right? So this was a massive unlock, and this is why it's so important to start with math, is because you need to know, you need to be able to use these tools. Uh, so anyway, number one was first, but later on they learned that there's zero. And magically somehow there's a negative numbers.

[00:31:07] Sahil: I don't know what a negative number is. I've never seen a negative number, but there's a negative number, uh, negative one, right? We can call this balance, right? Every, every, every positive must have, uh, an opposite. And so the concept of one can create a negative one. And then you have two, three, four, and this is it, by the way.

[00:31:28] Sahil: There's no, nothing in between here. There's no con, there's nothing that's like 1. 5. Okay, don't give me that crap. I've never seen 1. 5 anythings. I see them in statistics and like, you know, data and calculators, but in real life, I don't see it. So, so we're just going to, We're basically just going to have this for now, uh, we're not going to think about decimals, just this is like first grade maybe math, I think, at least I grew up in Singapore, so Singapore math might be a little crazier, uh, but this was like first grade math, I think, [00:32:00] uh, and then second grade was, uh, was addition, right?

[00:32:04] Sahil: So what is addition? Uh, addition is the first law, I consider it, of math. Addition is, how do you go from one to two? Right, right, right. Basically, how do you go from 1 to 2 or from 2 to 3 or from negative 1 to 0? Well, you add 1, right? So addition is quite simply adding 1. So the way I would draw this is like this, right?

[00:32:31] Sahil: So you have 1, you put a number in there and you get another number, right? You put 1 and you get 2, you put 2, you get 3, you get 3, you get 4, right? That's what addition does. Now, why is there no, and if I were to learn this, by the way, like when I have kids, I'm basically going to sit down and say, okay, zero plus one equals one, one plus one equals two, one, oops, sorry, two plus one equals three, three plus one equals four, four plus one equals five, five plus one, six, six plus one equals seven, seven plus one equals eight.

[00:33:22] Sahil: 8 plus 1 equals 9. 9 plus 1 equals 10. 10 plus 1 equals 11. And the reason you have to do this is that there's no simplification of what's happening here, right? Like, let's say you showed someone, an AI fully understood this. You trained a model full of training data on all of this stuff, right? Well, and then you said, okay, what's 11 plus one?

[00:33:56] Sahil: They don't know that AI is not going to know because they don't know the concept of [00:34:00] 12. These are fundamental. It's like, it's like you could show someone 8 billion humans. They're not going to be able to predict the 8 billionth in one human, right? Each number is fully unique. Each number is a person in this world of numbers.

[00:34:15] Sahil: And that's why you have to do plus one, plus one, plus one in order to get to the new number is by finding it and learning it. and memorizing it. And this is why math is so hard is because you literally have to memorize. All right. So cool. We have addition. Great. Great. That's a good one to know. Uh, if you didn't know addition, that's what it is.

[00:34:38] Sahil: You add a number, add one to it and you get the next number. Uh, by the way, subtraction doesn't exist. Okay. Subtraction is not real. Have you ever seen, for example, have you ever seen anything get subtracted in reality? No, right? No. Uh, you can see things divided. You can take it like an orange and divide it.

[00:35:02] Sahil: But what is division, by the way? You're actually multiplying it by two, right? You're actually adding one, right? Actually, when you cut something in half, you're doing addition. You're adding one. So this is a fundamental law of the universe. is you can, you can, like, how do, how do eggs, like, how do, how do, how does life happen?

[00:35:20] Sahil: One becomes two. Two does not become four. One of the twos, one of the ones becomes another two, and one of the other ones becomes another two, and together they become four. But two never goes to four, because that's not possible in reality. The only thing that's possible in reality is addition. Two halves can only become three.

[00:35:42] Sahil: That's it. You can only add one. Notice that I did not circle the plus one here. Right? And this is like, this is fundamentally important because if you don't understand this, you're not going to understand what computers are doing. Computers exist in the real world, and so when they're, when I'm when you're asking a [00:36:00] computer to add things, That's what's happening.

[00:36:03] Sahil: That's what the code is doing is it's taking the two and then it's adding one to get three, right? If, if you're say two times 10 and it puts 20, the computer is saying what I just did, right? If you say two times 10, and you know the apple, new Apple intelligence, right? Just auto-fills like magically 20.

[00:36:27] Sahil: What's actually happening? It's, it's going, it's doing this. It's going back to the Law of Addition because that's what transistors are. It basically has embedded this concept. And it says, okay, you want to do 2 times 20. That doesn't exist, but I can break this down. And that's one of the things I said, how to break down problems into smaller steps, right?

[00:36:46] Sahil: So let's talk about that in the lesson. Uh, well, we got two here, right? That we can, we can do the Law of Addition. One. Okay, how many times are we going to have to do the Law of Addition? The law of addition has to happen 10 times for each two. So you can almost say, we're going to have to wrap this and we're going to have to do this 10 times, and then we're going to have to do this, the original number of times.

[00:37:16] Sahil: So what's happening is you're actually running addition, but you're not done because you actually have to subtract it. So then at the end, you have to do something like this. Uh, so you end up doing like, this is, this is like input number two. This is input number one, and you end up with, you know, 20, or whatever, and I think this works.

[00:37:39] Sahil: Uh, I would have to, I would have to actually double check for math on that, uh, but anyway, we have addition. The other super important thing about addition that people should understand is this equal signs. You need this equal signs. If you ever programmed anything, there's a shitload of equal signs, right?

[00:37:56] Sahil: You need equals, right? So let's talk about what, what, [00:38:00] why, what is the significance of equals? And the significance of equals is it's a way of basically updating the condition on the left in programming, but in math, it's saying literally that these conditions are equal, right? And what that means is you can swap them out.

[00:38:20] Sahil: And so this is called a transitive property of quality, I believe, but basically it's a fancy term. But if you say one equals one, that also means you can say one equals one, right? If you say A equals B, You can also say B equals A, and that's very, very, very important because this allows you to store knowledge in numbers.

[00:38:47] Sahil: So, for example, if I say Sawhill is hungry

[00:38:56] Sahil: and hungry is angry, what can you say? You can say Sawhill is angry, right? You can make that logical leap because Sawhill, oops, I misspelled my own name. That's all I've got to say. Thank you. Okay, you can also say angry equals saw

[00:39:27] Sahil: and because you can do that, it allows you to rearrange a statement without updating the actual statement because of the transitive property of equality. So you have the transitive property of equality.

[00:39:57] Sahil: And just to give you an example, what that means is one plus [00:40:00] two equals three. You can also write as two plus one equals three. And you're like, oh, maybe this is so simple and basic. I can't believe Sahil is spending his time teaching us This kind of stuff. But as I said before, what you've learned is, hopefully as part of this, is that subtraction doesn't exist.

[00:40:21] Sahil: And a proof, I want to prove this to you by saying you cannot put a minus sign there, right? Because if it said 1 minus 2 equals, well yeah, you could say 1 minus 2 equals negative 1, but then 2 minus 1 equals 1. So subtraction doesn't work. Subtraction does not have the transitive property of equality.

[00:40:49] Sahil: Only addition. So this is, this is really important, because if you don't really fully understand that, it's going to be, you're going to, your code's not going to work. And you're going to be like, you're going to try to spend all your time in HTML and JavaScript and CSS and blah, blah, blah, blah, blah, blah.

[00:41:07] Sahil: But actually the issue is right here. It's first grade math. You can't switch these two things. Right? And you're going to look at a bunch of code, and it's hundreds of lines of code, and you're not going to know what the frick is wrong. And you're sort of probably not going to go to the fact, like, to all the way back to first grade math is your problem, right?

[00:41:27] Sahil: But that's what it is. Uh, and so, so we have that. We're almost done with, with math up to Algebra, if you can believe it. We're speeding through. We're in, we're in second grade. We're going to go to second grade now. Okay, everyone ready for second grade math? Second grade math is multiplication, right? So we're going to do multiplication.

[00:41:46] Sahil: Multiplication.

[00:41:53] Sahil: And multiplication does exist in the real world. Addition and multiplication do exist. [00:42:00] Multiplication, you can see, animals reproduce and multiply. Uh, life, life is multiplication. Outside of life, outside of DNA, there is no multiplication, uh, in the entire universe. In the entire universe, there's only addition, right?

[00:42:21] Sahil: For example, the four trees. You had water, you had fire, you had earth, you had wind, you had planets, which are just basically big balls of rocks and fire and water, floating around the space, which are just addition, it's just division, right? Everything was one thing, and then one became two, two became three, three became four, four became five, five became six, six became seven.

[00:42:49] Sahil: And that is why it took so freaking long, hundreds, billions of years to get to life. Life is just a big number. Imagine life is a really large number, right? It takes a lot of time to get to that large number. It took billions of years. And that number, unique number, uh, could have this new property associated with it, which is multiplication.

[00:43:13] Sahil: Only this new number could do it. And how fast can you multiply, right? Think about how fast you can go from one to 10, one to a hundred with addition. One plus one equals two, two plus one equals three. It's going to take a lot of time, right? A lot of energy, a lot of logic, a lot of whatever. But if you have multiplication, what can you do?

[00:43:33] Sahil: You can go from one, you still have to additi additi you know, one times one, you're not going to get anywhere, right? So. You gotta get to two. So you still have to go from one, one plus one equals two. Well, now you have two. So now what can you do? You can go two plus two, you get four. You can now, now you have four.

[00:43:56] Sahil: You can do four plus four, eight. A [00:44:00] eight, 16. 16 plus 16. 32. 32 plus 32. 64 is how old I'm, by the way, happy birthday. Me two, power, whatever, five, I think. Uh, 64. Oh, you can't do 64 plus times two, right? Because. It's going to go over a hundred. So what do you do? You do 64 plus 32. That equals 96 plus does it 96?

[00:44:40] Sahil: Yeah. Okay. Now you need four plus four. It goes on. So in that many steps I was able to get instead of a hundred steps from one to two to three, and that multiplication is what creates all of this crazy shit. You see, without multiplication, you just have fire, earth, fire, Wind and water. You don't have trees.

[00:45:03] Sahil: You don't have ducks. You don't have humans. You don't have love. You don't have consciousness. You don't have any of these things. All of those things are created by multiplication. And that's why multiplication is so important, why we teach it to people in second grade. Uh, and so, let's do multiplication.

[00:45:29] Sahil: Multiplication is, let's say, you take a number, and you add it, you add on

[00:45:41] Sahil: the number of times. Right? So you take two, and you basically multiply it by, you add, you, you, when you multiply by ten, you add one ten times, right? Um, by the, and so, in a [00:46:00] way, the way I think about it, is this is a fundamental concept, because this is the first time in history, and this is why only life can be self conscious, self aware.

[00:46:09] Sahil: Because what is multiplication? Multiplication is a number, knowing about itself. It's somehow able to use itself in its own property, because when you multiply by 10, it has to know 10. And so the life is the only conscious entity on Earth, on, in the universe, and that somehow is also the only thing that can multiply.

[00:46:33] Sahil: And it's the only thing in math that has a concept of recursion of self awareness. Uh, interesting, don't you think? Something interesting there. Uh, but that's what multiplication is. Multiplication is just self aware addition.

[00:46:54] Sahil: All right, so that's about that's math. That's like math and then algebra. Okay, let's do algebra. We're almost done. Uh, then I will go to questions. Uh, but, uh, just to do one more thing.

[00:47:11] Sahil: We'll do some algebra. All right, first, let's do some math. Let's just do some really basic math. Uh, so I'm just going to say like, you know, two times three plus four plus one. All right. Actually, I'm going to add more times, like two plus three times. What is, what does this equal? Uh, everyone should do it.

[00:47:32] Sahil: If you haven't had a paper, I highly recommend just doing this exercise. Uh, I'll do it for you. Uh, so, you know, this. This is 6, this is 4, this is 2, this is 6, this is 10, this is 8, the 18th, right? So this equation becomes 18. But how was I able to do it that fast is going to be [00:48:00] some, a first grader is going to ask me that question.

[00:48:01] Sahil: Like, how did you do that so fast? That's crazy. How did you do it so fast? You went from that to that in like a split second, right? Obviously, if you know math, you're probably not super impressed. But that's fine because really what I was doing was I was going back to what I was doing before. And I was just doing addition, right?

[00:48:22] Sahil: I knew that 2 plus 1 equals 3. I knew that times 3 is 2 plus 1, right? This sort of minus the initial number. Minus n. Actually, it should be minus 1. Technically, it's this. It's the, It's, it's the number minus one, actually. So then, you know, that leads to six, this is still four, blah, blah, blah, blah. So, you're just going back to addition, and that's why people memorize the multiplication table instead of doing addition all the time.

[00:48:55] Sahil: But the multiplication table is just memorization of these shortcuts, right? I can just go two times three equals six. I don't have to do the math every single time, but that's all it is, is just memorization. There's no way around that. Uh, as I mentioned, there's fundamental, uh, so like, there's not, there's, you can't break it down any further, right?

[00:49:13] Sahil: Um, and, and so let's, so now that you've done this, we can like, kind of go do some algebra. So that's, that's second grade. Now we're in third grade, uh, third grade's algebra, I think, I could be wrong by the way, I don't know. But, uh, yeah. Yeah. Yeah. Uh, but algebra, you know, basically the concept of algebra, to me, in my thinking, is it just allows you to introduce the concept of the alphabet, right?

[00:49:39] Sahil: So instead of saying one, two, three, four, you now have variables, right? So you could say a plus one equals two. What is a, right? So if a plus one equals two, what is a? What is it? [00:50:00] It's one, awesome, right? It's one. A is one, and then if you do something like B to the power of two, minus, you know, plus C equals twelve, ten, you know, B is two, C equals five, what is A?

[00:50:23] Sahil: What is A?

[00:50:30] Sahil: It's one! It's one. And the reason it's one is you can take those, you can put them in these places, right? You can replace this, this becomes four, this is five, and then one plus four plus five equals ten, so a is still one. I kind of got lucky there, honestly, that's kind of funny how that worked, otherwise it could have been a weird, uh, weird situation.

[00:50:53] Sahil: Uh, and that's algebra. That's it. So that's third grade, right? That's all the math in, that, that I think we really need in order to do, uh, programming with math, right? So first grade, second grade, third grade, we're done. Uh, but it's, it's helpful, I think, because, you know, you just want to make sure everyone's on the same page.

[00:51:18] Sahil: So now we can talk about programming, programming, and then we'll build, we'll build stuff soon. So programming, we already covered one of the, one of the three. Variables. We're done. We already covered variables.

Right? Variables is just algebra.

[00:51:43] Sahil: There's, uh, loops, and there's conditionals.

[00:51:52] Sahil: And all programming is, is basically wrappers around addition and multiplication, right? Uh, and so, [00:52:00] you know, you could even write, like, multiplication is a loop, right? It's a loop of addition, right? If you multiply by ten, you add the number ten to itself ten times, right? Uh, or nine times actually. Right. Uh, so, uh, let's write that out actually.

[00:52:21] Sahil: This is maybe even a better way of thinking about it, but let's say you had a function called multiply. So I'm just in bed. This is what I'm inventing. This programming language, by the way, it doesn't exist. Uh, I think maybe it's a real one. Uh, maybe it's Python, but I think maybe it's by the high power.

[00:52:38] Sahil: And def multiply, you get a number, right? What does this do? Well, you just. Do addition, but you, you, you add it to itself. So you take the number and you add it to itself

[00:53:09] Sahil: and minus one times, right? So if you had multiplied, let's just make sure I'm correct. If you multiply by 10,

[00:53:22] Sahil: then you, you know, it's a two dot multiply 10 or something that should equal 20. Oh, there's equal signs here again. Boom. I told you math's important to programming. There's equal signs. You've got 2 plus 2 times 9, right? 2 plus 18 is 20, right? So, programming is loops and conditionals, uh, kind of wrapping around variables, wrapping around the multiplication and the addition that we were talking about before.

[00:53:56] Sahil: And so, we have that, let's do a [00:54:00] loop. A loop, there are two kinds of loops, and there's effectively one kind of conditional. So we're going to learn this, and Super fast. The, by the way, everyone's already done with the hard part. The hard part was addition and multiplication. It's only getting easier. So loops, you have four loops, which I've never used basically, but whatever, you got to understand, uh, four and while basically.

[00:54:24] Sahil: Four and while, right? While,

[00:54:36] Sahil: now what's the difference? What are these two, right? While is indeterminate. So while something is true, keep doing it forever, right? So for example, you might say, Okay. While I'm for work hard,

[00:54:58] Sahil: right? This will just keep running until I'm for changes to false, right? At some point. So this code will run in a In a, in a Python script or in something like that. But first of all, just covering these pods and then four, four is a determined, you already know how many times you need to run it. So you could say four, you know, I equals zero.

[00:55:28] Sahil: I is less than 10. I plus plus now you can start to see like part of the confusing parts of programming. Uh, this is like, I, this is where I stumbled when I was learning this stuff. Uh, what's the, this for the freaking for loop, man. Uh, and then you can do something, work hard, right?

[00:55:53] Sahil: Now what, what does this for loop say? It says starting with i equals zero, [00:56:00] run this. Once it's done, run this function, which increments i by one. All this is doing is addition, the law of addition, plus plus, right? So i equals zero, you work hard, work hard. Then i equals one, and you do work hard again. Then i equals two.

[00:56:19] Sahil: Work hard again. And you keep doing it until this condition is no longer true. So negative less than 10 means it'll run until i equals 9, but it won't run for i equals 10. So it'll run for i equals 1, 2, 3, So if you add those up, you'll get the number of times the for loop will run, which if you take an APCS class in the United States of America, That will 100 percent be one of the questions, is, they'll give you a for loop, it'll say int i, i is less than 3, i how many times will this for loop run, and the answer will be, it'll run for, you know, normally it starts with i equals 0, actually, so it'll be 0, 1, 2, which is 3, 3 times, right, uh, that's, so that's variables, that's loops, And that's conditionals, addition, multiplication.

[00:57:18] Sahil: That's everything that we need to know in order to build a GPA calculator, uh, I think. Uh, and so we can, uh, basically move to, we did technically, we didn't cover division, division in an abstract concept. Uh, but you can think of it like, uh, times one over, but we'll cover that. I think it's easier to cover that actually as we get into, uh, programming.

[00:57:41] Sahil: So let me do some, see the chat, uh, and then see how it, how it does. Uh, any questions Ben people have on my stuff?

[00:57:53] Ben: Um, no, I don't think so. There's lots of humor thrown around. Instead, [00:58:00] um,

[00:58:02] Sahil: we'll talk about theory and prisoner's dilemma, uh, which is a, a, uh, I mean, I guess one, one other thing we could cover if people don't have questions, then I'm gonna keep going until you guys have questions.

[00:58:12] Sahil: Uh, is data structures an algorithm so we can at least cover the data structures part before we get into programming? Uh, data structures like SAT,

[00:58:31] Sahil: algorithms, and I'll just cover it because someone asked on the chat, procedural lemma and game theory generally, very important concepts in programming. Even if you don't think they are, hopefully I can explain to you why they are so fucking important. You can't actually build anything without understanding them.

[00:58:56] Sahil: Uh, anything useful anyway. Uh, nothing we built today has been useful, right? So, uh, data structures and algorithms is pretty simple. There's just dictionaries and lists.

[00:59:14] Sahil: Really simple way to just think about it is that you have, you know, again, this is one of the rules of the universe that we're programming, right? What, what basically, what are the primitives that we have access to? Uh, we have dictionaries, dictionaries are key value stores effectively. So you can have like name is Sawhill age 32, et cetera.

[00:59:43] Sahil: Right. That's a dictionary. A list is an array. So that's what it looks like. Okay. You know, a list is, you know, ages equals, right, and then you have 32, 33, [01:00:00] 41, and that's a list. Now, combining these, this is a variable. Ages is a variable. It's now a list instead of a single number. And you can now do all sorts of looping and conditionals.

[01:00:17] Sahil: And, you know, effectively, that's what algorithms are. Algorithms are manipulating data structures, right? So a very simple algorithm is addition. Addition is a kind of algorithm. You take one and you get, an algorithm is just like a function, and it takes an input and it gets an output. That's all an algorithm is.

[01:00:32] Sahil: Uh, so for example, you can have an algorithm that sorts this, right? It sorts these ages. But how do you, how do you do it? How do you actually sort? Uh, sorting is prisoner's gum. It basically is this awareness that people need, the numbers have to have, and you have to re sort based on some smaller rule, right?

[01:00:56] Sahil: Uh, and so that's data structures. Let's do prisoner's dilemma, which is a very simple algorithm. What is prisoner's dilemma? For people who don't know prisoner's dilemma, prisoner's dilemma is, let's say you have two people, uh, who've gone to jail, right? Two people who've gone to jail, two prisoners. You have prisoner A, and you have prisoner B,

[01:01:22] Sahil: and the police goes to them and says, Hey, uh, you both get five years in prison right now. If you rat out the other person, you, they will serve 10 years in prison, and you'll serve zero in prison. Okay? Well, and this is the deal given to both sides. And if you, neither of you, so if you rat out the other person, they get 10 years, you get zero years, right?

[01:01:54] Sahil: If you both rat out each other, you get five years each. If [01:02:00] neither of you rats out the other person, you get one year each. So what happens? This is, and this is, this is, this is purely a deterministic thing. What happens, right? So just to like visualize that, In this situation, where they don't rat the other people out, they get one year each, right?

[01:02:23] Sahil: One, one. In this situation, they get five years each. Five. In this situation, this person gets zero, this person gets ten. In this situation, this person gets ten, this person gets zero. Right. So what, the best situation here is this one. But what, what happens? Does the best outcome happen? And the answer is no, then this is why it's called a dilemma.

[01:02:55] Sahil: Uh, the doesn't happen. What happens in this situation is this happens. Five, five, five, five.

[01:03:08] Sahil: What happened? Why does that happen? The reason five, five happens is because think of it. You're looking at this from the perspective of the system, but that's, you're not making the decision. The decision is being made by Prisoner A and Prisoner B, right? And so what would Prisoner A do? Let's go through Prisoner A's situation, then we'll go through Prisoner B's situation, which are very similar, right?

[01:03:35] Sahil: So what would Prisoner A do? And if, if Prisoner A chooses to, to rat out, this is ratting out, right? This is like, This is ratting out

[01:03:50] Sahil: and this is not ratting out over here.

[01:03:56] Sahil: Prisoner A [01:04:00] gets zero years if they rat out here and five years if they rat out here, but they have to think about what is B going to do, right? Because if B does a rat out or does rat out and they don't, they get 10 years. So in both of these situations, in this case, it makes sense to rat out, like let's say B does rat out, right?

[01:04:26] Sahil: Let's say A thinks B is going to rat out. Well, they're better served to also rat out, right? Because they'd get 5 instead of 10, right? But what if B doesn't rat out? What if B, they're like, B is awesome. B is awesome. Well, guess what A is going to do? A is going to rat out, right? Because if B doesn't rat out, and A doesn't rat out, A gets one year.

[01:04:52] Sahil: But if B doesn't rat out, and A does decide to rat out, they get zero. Right? So, basically, it always makes sense for A to rat out.

Unfortunately, the same thing applies to prisoner number two.

[01:05:11] Sahil: It always makes sense for B to write out. And so even though as a observer of this system, you see that the best situation for both of the prisoners should be one, one, one year each.

[01:05:30] Sahil: They actually end up with five years each and why, like, it just, why does the prisoners don't have anything to do with programming? And the answer is this is an algorithm, right? This is a decision. Like the reason you write code and functions. is to take complex situations, which is basically data that's in different forms, and getting a something out of it, right?

[01:05:55] Sahil: A yes, a no, a decision, like that's why we program, is to make [01:06:00] programming is for making decisions, right? Uh, and this is a really good example of a very simple, but it also shows you a very simple is also very complex, uh, situation. And this is just addition, right? All I was doing, like, was like one, It is less is, you know, one is more than zero, uh, 10 is more than five, right?

[01:06:28] Sahil: And you could, you know, and so if you wanted to write a programming, you could say, you know, like for, you know, a, you know, and then, you know, if a one is greater than a two rat out or whatever, right?

[01:06:55] Sahil: Else. Don't write out. And then this is the last part, which is the conditionals. So prisoner's dilemma, I think is a great way of understanding loops, conditionals, variables, data structures, and algorithms are all embedded in prisoner's dilemma. And prisoner's dilemma to me is like, is like one point perspective of programming, because it is like the first, it's the first time you'd ever need to quote unquote program, which is it's you against the man.

[01:07:25] Sahil: There's like some system that you're trying to wrap your head around, which is what programming is. And it uses all of these things, you know, else don't read out. And it also teaches you data structures and algorithms because this is actually, you can't actually represent this in this clean way. How would you represent this in Google Sheets?

[01:07:45] Sahil: You'd have to like come up with a different system of representing all this data. So if we want, we can actually build a presumed element with code as well. Um, but I think it would be, it would be easier and, and, and, uh, more, uh, more fun to do a GPA calculator. [01:08:00] So yeah, so that's, that's the, that's the thing.

[01:08:07] Sahil: Let me just go through the chat.

[01:08:13] Sahil: Uh, yeah, it seems

like people are, are, uh, not too many questions. Awesome. So yeah, let's go, let's go to sharing my screen.

[01:08:23] Sahil: Uh, and we can actually code some stuff. Um, yeah, so I want to do a GPA calculator. Uh, so a GPA calculator, and I'm just going to spec it out first. So let me open a terminal. I just created a new, uh, folder, so there's nothing in my folder.

[01:08:46] Sahil: LS it's like list, I think, uh, list stuff, maybe, who knows? Cause there's nothing here. Uh, but just for my own sake, I'm just going to create a file called readme. md. And you can see it shows up right here on the left. So I'm now in a folder called pre coding. There's a, there's a markdown file called readme.

[01:09:05] Sahil: This is just basically a scratchpad for me. It's just mostly so I can type and then I can basically tell the cursor to like take it and. And turn it into whatever we want. So I want to build a GPA calculator, calculator. Uh, you know, the easiest way to do it might be to show someone what a GPA, like build one without code, and then we can codify it basically.

[01:09:29] Sahil: Right. So a simple one would be, you know, let's say I'm taking math, English journalism. I have an A, obviously a B and a C, and I want to know my GPA, right? That's basically like a really simple. Simple thing. Well, what is it? How do I, how do I actually get this? I don't know. Error, right? [01:10:00] Uh, well, okay. So now, now all of the stuff we've learned, we're now having to think about and implement data structures and algorithms, loops and conditionals.

[01:10:08] Sahil: It's all going to start happening. Okay. Uh, so one, we need to correlate these into numbers, right? Uh, so you need a table, right? That's basically like

[01:10:22] Sahil: Grade to number, I guess, right? And you have A, B, C, D, E, F. There's no F or there's no E. This I think is a 4, 3, 2, 1, 0, right? Something like that. We can move this up.

[01:10:42] Sahil: So you have grade to number. And then what is a GPA, right? A GPA is an average, right? So an average is just adding and then multiplying or dividing by the number. Uh, so GPA would be Math plus English equals math, plus English, plus journalism, divided by number of classes. Well, it didn't work. Okay, well I need number of classes.

[01:11:12] Sahil: Number of classes has to be a variable.

[01:11:19] Sahil: I guess count would be something.

[01:11:24] Sahil: Oh, no, it's zero. Why is that zero? Well, I'll hard code it for now, and then we can, uh, we can make it more dynamic if we wanted to. Uh, let me move these down so later when we make it more dynamic it'll just auto update.

[01:11:40] Sahil: Uh, but number of classes, I can replace this with this variable still zeros because these don't exist. And so I basically need to convert these each one. So equals how do I even do this? I don't even know, to be honest. [01:12:00] Uh,

[01:12:05] Sahil: I'm not good at, uh, at this kind of stuff. Uh, but I guess we can just do it manually. I'll just say this is for now we can do it manually. Four. This is a three. This is a two. Uh, and then this is going to, you know, be equal to that. This is going to be equal to that. It's going to be equal to that. I don't need these extra equal signs.

[01:12:35] Sahil: Why is this? The reason why is this wrong? Boom. This is a good, this is a good example of something we didn't cover yet, which is the order of operations. The order of operations is that the later it comes in your mathematical learning, the more it has precedence, the more important it is, the faster it runs.

[01:12:54] Sahil: So, division came later, which is why it happens first, so what's actually happening is you're doing 4 plus 3 plus 2 divided by 3, which is not what you want to do, you want to take all of these numbers.

[01:13:10] Sahil: So that's my GPA, right? My GPA is 3. If I change this to a 2, my GPA is now 2. 6. And, you know, you have like a GPA calculator. This is the first thing I built. And I want it to be basically, I want to rebuild this in code. And I think everyone hopefully wraps their head around this. Like a GPA calculator is a very kind of try to pick up the relatively simple thing.

[01:13:37] Sahil: Uh, someone says count a, so let's like try that function. I don't know what that is. The number of values in a data set. So if I go like that, Oh, cool. Yeah. Awesome.

[01:13:54] Sahil: So why is it count a? It might be because array, [01:14:00] array is, is a fundamental data structure. So array is a list basically. And so maybe it's count array, maybe. So that, boom, now we don't have to think about it. The cool thing here is in theory, you can add a new class, right? You can say, oh, I now want to take calculus, but honestly, I'll probably get a D.

[01:14:27] Sahil: Oh, shit. It's going to drop my 25. I shouldn't do that. Boom. Now you have game theory again, right? The thing we just talked about, this prisoner's dilemma effectively is happening except with four prisoners now, right? Like, if you, it's, again, this doesn't have to make complete sense, but I'm just trying to explain.

[01:14:46] Sahil: Like, the self awareness of classes and knowing about the system and doing all that complex math is happening. super fast, but it's all going back to what we just covered, right? Uh, that's all the computer is doing, is that kind of stuff. Prisoner's Dilemma, it's just doing, running Prisoner's Dilemma, it's just doing addition, it's just doing multiplication, multiplication turns into addition, blah, blah, blah, blah, right?

[01:15:06] Sahil: Uh, so we got four classes now that updated, uh, this, but the problem is this didn't, this didn't automatically get filled. Right? So let me ask Claude how to do this, because I don't actually know. It's a VLOOKUP. That's not enough. That's not enough for me. Someone said VLOOKUP. I'll add that to the prompt

[01:15:39] Sahil: with the grade two number equivalent of the right figure. And let's see what it tells me. VLOOKUP! Who knew? All he knew. All he knew. All he's like, man, this guy's an idiot. [01:16:00] Uh, it is true. Kind of crazy how dumb you can be to run a 20 million revenue business with two full time employees. Right? Pretty crazy.

[01:16:09] Sahil: Pretty crazy. Oh, fuck what I did. Okay, so that, oh, kind of, it got this wrong. But I assume it's trying to get to G H, and this should be 2 to 7.

[01:16:29] Sahil: 2 false. Uh, why is this not working? Range index is sorted. I'll ask Bob again. You know what would be cool? As soon as this will all be built right into here and there'll be like a chat. And, you know, I shouldn't have to go to the log for this, but. Oh, it explains it. B two is the, is the, is the lookup value.

[01:16:55] Sahil: Oh, okay. So this has to be ba Basically what you want to do is, uh, I see what you mean. So basically it's like B lookup. This is gonna be the key. Then you want the range, which I assume is gonna be something like that. And then you're gonna want like zero, right? Something like that.

[01:17:21] Ben: No, you're gonna want two because you want the, the value from the second column and then false.

[01:17:28] Sahil: One.

[01:17:30] Ben: No, I think it's two. Then you've got to do false after.

[01:17:35] Sahil: Oh, it corrected me.

[01:17:36] Ben: Oh, there we are. One.

[01:17:39] Sahil: Oh, wait. I wanted to do from C though, right?

[01:17:44] Ben: So then that might be. Then you

[01:17:44] Sahil: said two.

Huh.

[01:17:49] Ben: We need Ali.

[01:17:51] Sahil: Yeah, maybe G. Yeah. Boom. All right. I got it. Easy. There you go. So now I can delete [01:18:00] this. Now I can update this to actually be using, actually what I should do is then I can just move these guys here.

[01:18:12] Sahil: Right. There you go. Awesome. Uh, the cool thing here now, I think, uh, Oh no, it doesn't. So now I want to do this. I want to replace this with a sum

[01:18:26] Sahil: of all these, and this is programming, right? I mean, this is programming. It's just, you're not thinking about the programming itself, but this is no code in theory, right? Basically. Uh, something like that. Right. So now in theory, let's check this out. If I add it, I wanted to test a class like geometry or something, and I'm going to get an A plus in it.

[01:18:48] Sahil: Boom. Didn't work. Why didn't it work? Oh, it's because I didn't add this here. So I just have to put this here. Changes my GPA. Right? And then let's say I got a D. It lowers my GPA 1. 6. Boom. Awesome. Right? So it all works. It all works, right?

[01:19:08] Ben: The column D, uh, D for geometry, you've done the wrong formula. You didn't pull the formula down, so I think it's the wrong

[01:19:16] Sahil: Oh, yeah, yeah, yeah.

[01:19:18] Sahil: It should be a 7. Like that. There you go. Yeah, sorry. You're right.

[01:19:27] Sahil: I don't know why this is weirdly aligned. But to manually fix that, uh, well, that's pretty cool. Uh, now we can basically do the same thing with cursor and like actually build all this stuff using a lot of the stuff we talked about. And hopefully we can start to see what, uh, what it does. And now we have some new, maybe language to describe, to, uh, to describe it.

[01:19:53] Sahil: Uh, let me just clean this up a little bit, [01:20:00] make it pretty.

[01:20:06] Sahil: Not, not. Alright. Uh, so what I'm gonna do is I'm just gonna basically take a, take a screenshot of this. I turned out, I don't really need to read me, uh, but I'll just, I'll go to Cursor. I'm just gonna go to, uh, the composer feature. So the composer feature is, uh, command shift. I, uh, if you, if you want to just do command, I also, you can do kind of a small version of it.

[01:20:34] Sahil: Uh, but composers kind of for like. The whole project is how I think about it versus like just a single file or so. Um, and then say, I want to, let me just do a write a Python script,

[01:20:51] Sahil: their classes and their, uh, GPA, uh, their grade letter grade, I'll say, and calculate the GPA. Right. So that's it. I'm going to provide, here's a example of a

[01:21:13] Sahil: functionality.

[01:21:19] Sahil: Right, so I'm just doing Python scripts, uh, no HTML CSS, website, web app, any of that kind of stuff. Because at the end of the day, if you want to turn it into that, well, you're just, it's a wrap around that anyway. So we'll start here and see how it goes, I think. Uh, so let's just submit that, uh, and yeah, I can increase the font size.

[01:21:45] Sahil: Uh, sorry, I can't increase the font size that much. Uh, so I need to be able to see it. Okay. So what does it say? Certainly I'll create a Python script that takes this blah, blah, blah, blah, blah, blah, blah. Here's the code. So I wrote this [01:22:00] code, uh, and created a new file GPA. I'm just about calculator. py and, uh, it did it right.

[01:22:09] Sahil: So define the calculate GPA, create some dictionary of letter grades, prompts the user to enter class names, letter grades, and credit hours for each class validates user input. I mean, this is more than, you know, I mean, how long, imagine how long this would take to write code for, right? Uh, calculate the GPA using the formula, rounds the GPA.

[01:22:29] Sahil: Oh, that's nice, two decimal places, prints the final GPA. To use this script, save it as. So I'm going to, Oh, would you

like me to update the readme?

That's awesome. Thank you.

Cool. So it's doing that. So it's making the changes,

[01:23:01] Sahil: blah, blah, blah, blah. Okay, cool. Uh, so let's accept that. Uh, we have this function and we have a readme to use it.

So you guys want to try it and see if it works. So yeah, let's just try it. Run the script

[01:23:20] Sahil: by typing. Python, gba calculator. Welcome to the gba calculator.

[01:23:25] Sahil: Enter class name. Okay, so class name, let's just go with this. Math, letter grade for math. Let's start. Uh, is, uh, is A. Credit hours, I don't even know. What the, it added this. Okay, sure. 12, I guess. Okay, let's, let's just do uh, English, B, 12. I'll just assume 12 credit hours is going to be the same for everything.

[01:23:53] Sahil: Uh,

[01:23:58] Sahil: Uh, I didn't go to school, so I don't know what a credit [01:24:00] hour is, uh, but 12c was reasonable. Maybe not. Well, I guess that's 12 hours a week. It'd be a lot. Yeah,

[01:24:10] Ben: someone's saying 12 is way too much. I don't know what the system is in the US. Okay,

[01:24:14] Sahil: I'm going to go down. It goes like three credit hours.

[01:24:16] Sahil: Journalism, Calculus, I'm going to say D, I'm going to say three credit hours, and then Geometry, I got A, and I'm going to say one credit hour, right? And then I'm going to hit, do I type Donald to finish? Boom, your GPA is 2. 35. So it worked. Cursor in one shot, all of the hour and a half, plus a lot more if you actually had zero context.

[01:24:45] Sahil: Think about how much time it would take you to wrap your head around all of the stuff we've talked about, uh, for an hour and a half. And in one prompt, which, can I pull it up? Let's see. All I typed was this. And I took the, I guess I gave it the photo of the Google sheet, but. You know, it's, it's, yeah, I

[01:25:09] Ben: did the same prompt without the Google sheet and has the same code.

[01:25:12] Ben: So,

[01:25:13] Sahil: oh, awesome. Cool. Yeah. I mean, so that's basically it worked. I mean, now let's review the code. So like, I do think that, you know, a lot of people are like, oh, AI, like, it's like, well, you still want to read the code, right? I mean, uh, so like, okay. So it took, it took this table and it turned it into this, this is what, what do we cover?

[01:25:34] Sahil: We already covered this. What is this everybody? Yeah. It's a dictionary. It's a dictionary. A dictionary is just keys and values, right? So all of us doing is creating a mapping. So that's why everyone, if you're watching that and you're like, why the hell is talking about all this random crap? It's right here.

[01:25:55] Sahil: Boom, boom, boom, boom. So it's just a mapping from letter to number, [01:26:00] letter to number, letter to number, right? Total points, total credits while true. So this is some, this is a. This is, uh, you know, the equality, transitive property of equality. Total points is equal to zero. You can revert these though. Do not type zero equals total points.

[01:26:20] Sahil: That doesn't work. The reason is, the way to think about this is like that. In programming, this equals that basically means this turns into that. So that's why you can't revert that. You're making total points equal to zero. Like if you were actually writing this, make total points equal, equal to zero.

[01:26:44] Sahil: That's. What python is compiling down to into, uh, moon cursor is not cool. And then you have a while true. As I mentioned, while true will run indeterminately infinitely until it's no longer true in python, there's this concept of break. So if you have a break function,

[01:27:12] Sahil: it ends this. It basically automatically makes this false. Okay, so that's The looping, and then now you have, uh, this is just like basically getting the input from the user. So, uh, that's the input from the user. And then, then you have, uh, a conditional, the conditional, which is just if. So if they entered done, and this just makes it lowercase.

[01:27:39] Sahil: So if I typed in like done or done, it would work. Uh, and the loop, and if it ends the loop, it basically skips down to this part. If there's total credits, there's zero just return zero. So it doesn't, because there were some [01:28:00] credits and then it would say GPA equals. So calculate the GPA. And all that does is say total points divided by total credits, and then it returns that GPA rounded to two decimal places and boom, you're done.

[01:28:19] Sahil: And. Uh, and, uh, just then to cover this, this bit, which is the only part of the code we haven't yet covered. It's another while true. So it's a true within a, it's a while loop within a while loop. This is what I'm talking about is all programming is, is like nested sort of addition and multiplication. Uh, grade equals input.

[01:28:45] Sahil: So you're just getting their letter grade here. If grade in grades break, what is this? What the hell is this? If the grade is valid, break the loop. Okay, makes sense. Basically you're checking, you're assuming that it's invalid, and then it breaks it if it's valid. So basically all it's doing is checking the validity, basically that you've entered a valid thing, right?

[01:29:15] Sahil: So for example if I ran this again and said calculus, and I got a Z, it wouldn't work, right? Z, Z, Z, nope, sorry, you have to enter A and then 1. I got a 4. 0. Awesome. Uh, so you have that, oh, okay, so then you get to this next while true, so now we, we've covered all the code except for this, while true, try, except, so this is the same thing, it's just, all this is, if you think about programming, like, this is so much of programming, right, it's just like, making sure the user enters the right stuff, right, uh, they don't enter in, like, blah, blah, blah, uh, so, try, so this, [01:30:00] but you, in theory, if you, if you trusted the user, you could even simplify this code even further.

[01:30:06] Sahil: But that's what a software engineer does is you, you hire them. You don't trust that the user. So anyway, so try credits equals float. And so you're just getting the credit hours and you're storing it to this credits variable. And. These only exist, uh, within these loops, right? Like, so, so credits is created and then basically this is the part where it, this is why programming is so difficult is you have to store what is in all of these variables in your head, which is why going back to addition, multiplication, data structures, algorithms, and algebra, algebra, this is all algebra, right?

[01:30:45] Sahil: So, okay, now you have credits. Uh, you have, uh, basically you're just combining, you're just using that to get the total points. The total points is, this is the part that does the mapping, right? So this A, what this does is, right, add the grade points to the total points. And that's, uh, it's, so it's like, you know, to explain that a little bit, it would be grades A, right, it would be like that, right?

[01:31:21] Sahil: That's what's basically happening is you, these total points is getting incremented, but it's getting incremented by the number of credit hours. So if a class has 12 credit hours, it's effectively gonna wait it 12 times more in the total points, and then you get the total credits total, and then you can, uh, basically divide those two numbers and you get your GPA.

[01:31:42] Sahil: And this is the first thing I ever programmed. When I was a kid, uh, and it's how I learned programming. This is, these are, this is programming. You've learned looping, conditionals, for loops, uh, all this stuff. So now we have that. That's really cool. Uh, but I want to make a little website. [01:32:00] Uh, and so I'm going to say awesome.

[01:32:09] Sahil: And I did say I would cover this, right? So over here, HTML, CSS for web structure and styling or web structure and styling.

[01:32:31] Sahil: No javascript. I don't want any javascript added, like, randomly. But some HTML and CSS to make it look nice.

[01:32:48] Sahil: Um, cool. So let's, uh, Before I apply those changes, let's open it up and actually, uh, test it. So,

uh, Did it not create it? Oh, I didn't create it. Uh, Why do you not create it? Is it when I close it? I

[01:33:18] Sahil: guess I canceled it when I did that. I'll save it and then we'll open it up and see if it worked.

[01:33:38] Sahil: All right. So you have this,

it's going to go to Chrome and open it up

[01:33:46] Sahil: and you have your GPA

calculator,

[01:33:49] Sahil: and that's just this file, you know, just some styling, your H1 tag.[01:34:00]

[01:34:10] Sahil: Uh, so yeah, I mean, it, you know, kind of works. This is annoying though. Like it does this like form action. So I'm going to actually say, rewrite this to do everything with vanilla JavaScript in real time, instead of having a form action as this is just local.

[01:34:35] Sahil: So go through all this, make some changes. They remove that. You see that it removed the, uh, form and just made it a div, calculated it.

[01:34:48] Sahil: It's just going through all the code and updating it. It doesn't need the name anymore because there's no form that's being submitted. So yeah, I'm just probably fine. I was just trying to calculate this.

[01:35:05] Sahil: English

[01:35:14] Sahil: S. Oh, it didn't work. Oh, I didn't refresh. Oops.

[01:35:23] Sahil: It's annoying because I don't, I don't want this calculate button. I'm too lazy. So I'm going to say I'm too lazy for a calculate button.

[01:35:41] Sahil: Also start with just one class and then add another class once I have finished. Typing in the credit inputs, values for each class. So this is now I'm like a PM, right? More than a [01:36:00] programmer, but, but I can do that because I understand what's happening. Right? Uh, most VMs wouldn't be able to actually do this because they don't actually understand.

[01:36:13] Sahil: All right. So let's do that.

[01:36:18] Sahil: Calculus. You see all that? I added that immediately. A plus 12. Boom. Change this to a F zero. Okay. All right. Let's say I got a B. But then I'm going to do English, a plus, and then let's say 12. Oh, okay. Awesome. 3. 5. Not bad. That's roughly what my GPA was. So, uh, 3. 5 is a good, good take. Um, yeah. I mean, so I think we basically, I mean, let me just cover my, my, my, my tweet that I tweeted, we covered that.

[01:36:56] Sahil: Let's make this all a little, this, we did that, we did that, we did that, we did that, we did that. We didn't do statistics and probability. Uh, we did that, we didn't do this, we did this. So we still have some stuff to cover. Uh, we still have time though, don't worry. But we have, I mean, we did it a lot, right? I mean, this is, this is pretty impressive.

[01:37:18] Sahil: I mean, this is like non, not zero. And think about how, this is 162 lines of code. Like think about how long it would take you to type all this. Even if you knew exactly what you were going to type. It would still take me like 30 minutes or an hour, right? And this took me like one second. typing that prompt.

[01:37:34] Sahil: Uh, so fun. So much more fun. Um, but yeah, I mean, let's

[01:37:39] Ben: just a couple of questions to, to, um, slot in here, I think. Um, yeah, DB asked for 10 year old is just starting out. Do you suggest that she should just focus on maths and supplement coding aid by AI, skipping coding and passing the buck to AI and focus more on basics of math?[01:38:00]

[01:38:00] Sahil: Um, I don't recommend skipping coding and passing the buck to AI because. Uh, the, the, when you, if you have a 10 year old kid, you want to, the only way they're going to become a programmer is if they enjoy programming. Uh, so the problem with skipping coding is that they will never learn to enjoy it. No one enjoys it in the beginning.

[01:38:27] Sahil: It's like swimming. Does anyone enjoy swimming the first time they swim? No, they feel like they're going to fucking die. Right. Does anyone enjoy biking the first time they ride a bike? No, it sucks. So like imagine it like it's like saying like I want my my kid to become a professional cyclist. Should I drive them around so that they can see what it's like to drive to move quickly.

[01:38:50] Sahil: It's like no you want them to build an appreciation for the fundamentals of programming. So I would not skip anything. I would use AI to learn faster. Uh, but I would not skip, uh, skipping, like you, for example, if we skipped, like, maybe some people thought it was weird for doing addition first. But if we skip that, none of this would make sense to people, like you would not have been able to read, like, I would not have been able to explain this stuff without using those concepts.

[01:39:22] Sahil: And even this arguably, you know, I don't know division. Can you rewrite this?

[01:39:39] Sahil: Boom. Okay, it's better. There's still this here.[01:40:00]

[01:40:01] Sahil: I don't know exactly. Yeah, see, it's still doing this, like, one divided, I think, uh, but, you know, start, you know, like. GPA is 0, 4, 0 in, and this is what I was saying before, the number of total points. It goes through 0, and it adds the total points divided by the, by the, uh, by the credits. Right? So it's really important to understand the code.

[01:40:30] Sahil: Like I read all the code that the AI writes. I don't skip any of it. Uh, right. For example, like I was working on Flexile yesterday.

[01:40:42] Sahil: Uh, so all that stuff I was working on. And we're like converting a table. This was done in one prompt with cursor. As you can see, it's actually broken, but all this was done, but I don't just push this production. I read all the code, right? Uh, so I'm not writing AI is writing all the code for me, but humans are reading all the code, uh, cause you need to understand what's actually happening.

[01:41:13] Sahil: And if you were to do it manually, you should be able to, you should always be able to do what the AI is doing. And the way you do that is you learn how, what it's doing. Okay. It imported this table component, then it imported this helper, and then it does this thing. And this is a data structure, right?

[01:41:31] Sahil: This is all the concepts that this is a dictionary. Uh, all the concepts that we're talking about, you know, you see if, if, for, in, right, all of this is, uh, is the concepts we're talking about. Uh, so yeah, anyway, that was a long winded thing, but.

[01:41:49] Ben: Yeah, and then you said this doesn't work. I guess it's related to a question about hallucinations of Cursor, because obviously it's using like Claude or whatever on the back end.[01:42:00]

[01:42:01] Sahil: Yeah, I mean, you're not going to get a lot of hallucinations with coding, because coding is very logical. Hallucination will show up with like a lot of art, a lot of Things in which you can't write tests for, uh, but yeah, I don't really find hallucinations happening too much in, uh, in programming, uh, personally, because it's kind of like one plus one equals five, like, it's just deterministic, so it doesn't create, the data set doesn't consist of hallucinations, so it doesn't create them.

[01:42:34] Sahil: But if you have like, for example, like, uh, an AI that you're using to write a fiction novel, then it's going to come up with all sorts of hallucinations. Like, hey, this character said this, but they're not even in the room right now. They just took a walk. So how are they saying this? And the reason is because there's no data structures and algorithms in fiction, right?

[01:42:52] Sahil: Right. Uh, like for example, if I were to write, let's say I'm going to do a new one, say,

[01:43:06] Sahil: Me a scene from a fictional, fictional novel in English, and then rewrite, right?

[01:43:28] Sahil: You know, something like this, what would it do? Think about how much hallucinations can happen in this context. Like any of these words could change. And there's no way to know that it's wrong, right? What if this said, Sarah began to choke? And you wouldn't, it would still be valid, quote, unquote, it's still valid English.

[01:43:50] Sahil: Uh, but in the context of programming, all of this. Is code. And so if [01:44:00] I change some, you know, these strings can still be hallucinated, right? So these hallucinations can still happen here, but none of the other stuff will be hallucinated. Like this location dot remove character. It's not saying like this person left the room, right?

[01:44:14] Sahil: What it's saying is a location consists of an array of characters. It's a data structure, which has an array of K it's a, it's a dictionary of one of the keys is a character, uh, is characters, which is an array. And you can run this function to add, which is a pending item to the array of a character, right?

[01:44:38] Sahil: So town square. Is a location town square. This is the description of it. And then you can add a character to it and then you could perform a ritual, which requires a location, a character, and whatever five is a number of spirits, you know, um, and, uh, boom, now you have, you know, you could even run this if you wanted to, like, put that in a Python.

[01:45:09] Sahil: So I can play.

[01:45:17] Sahil: It's not even really English. See, this is a hallucination. I just did put that in a Python. Like what does that even mean? Uh, but yeah, I don't find that hallucinations are a problem.

[01:45:34] Sahil: So yeah,

[01:45:38] Sahil: I don't write any code anymore. I don't, I've never enjoyed writing code. I enjoy building stuff. So if I can just write English and then the AI is doing all the annoying periods and colons and semicolons and dashes and care tags and all that stuff. And I just get to write English. That's great.[01:46:00]

Uh, so what do you think, uh, it doesn't work if I just did this. Welcome to the missile. Okay.

[01:46:22] Sahil: Uh, Oh,

[01:46:28] Sahil: okay. I mean, that's kind of cool. And like built a whole thing about how I didn't even check any of the code to change, but like, think about all of the complexity listed in here and it worked basically perfectly. Right. And then if you're like, okay, it's kind of weird. Why is it doing this? I can just highlight this and be like,

[01:46:54] Sahil: and then I'll go through it. I'll hit the code so that it doesn't happen.

[01:46:59] Sahil: Oh, it didn't do anything. I don't know. But anyway, um, yeah, that's how I, that's how I use, I use cursor.

[01:47:12] Ben: I think that's an interesting insight to see how all of that was made. And I think, like you said, why teaching the maths at the start? But then seeing it all come full circle, yeah, it's like,

yeah,

[01:47:28] Sahil: I mean, I, I'm, I'm talking to people who want to like be some of the best software engineers in the world, which requires learning all this stuff.

[01:47:38] Sahil: If you want to build a GPA calculator. The problem is like, you can build all sorts of cool demo apps, but no one's going to give you money for it until you actually build something novel, right? Like what, what Dwight Schrute says is he's only willing to pay for something if he can't do it himself. So in theory, if AI can do all the easy stuff for you, the only stuff you're going to be able to get paid to do is harder than what AI can do.

[01:47:58] Sahil: It's always going to be ahead of [01:48:00] what AI can do. Uh, and so math, the beauty of it is literally it's first, second grade, third grade math that here. I'm not asking people to learn calculus. Uh, If you want to learn calculus, we can talk about, we can talk about calculus. Uh, you know, rewrite this

[01:48:23] Sahil: and it'll do its thing. What will it do? I have no idea.

[01:48:35] Sahil: But this is how I would learn math anyway, right? This is actually like, all right, let's see what happens now.

[01:48:47] Sahil: That's kind of cool. Yeah. And by the way, this is a video game, right? All a video game is effectively a layer on top of this, right? Uh, it just renders the clock instead of saying what the angle is. It would just render the clock. Right. So like, you know, like, let's say I want to do one more thing, which is like turn this to gain dot HTML.

[01:49:36] Sahil: Like, think about how much code this is. This is insane. This would take me multiple days to do. Uh, will it work? I don't know. Uh, well, one issue is that it's a py file. I should rename it game. html.

[01:49:59] Sahil: [01:50:00] And what happens?

[01:50:10] Sahil: And it's kind of broken.

Yeah. Oh, that's kind of fun.

[01:50:23] Sahil: Yeah, I defeated the spirit. Ha ha ha, I win. I win the game. Uh, but look, I mean, all GTA 6 is, is basically a more complicated version of what we did. Like that's all, when you play a video game, It's just more of this, right? Like the stuff that makes it feel fun and real is just more and more complexity added on top, but there's no difference between like basically reading a book and playing a video game in terms of the actual story and the narrative.

[01:50:48] Sahil: It's all completely made up. Um, so yeah, I mean, you know, this, this, like the only thing, maybe one more thing is use React 3D Fiber to make, or actually use, I don't know, make this 3D, I don't know if this is going to work, but we'll see what it does. Almost definitely it's not going to work.

[01:51:14] Ben: But it's, it's, it's more interesting to see just trying stuff like this, how it changes the code, what that does to then the actual thing.

[01:51:26] Ben: And then you can like learning it that way, almost backwards. So yeah,

[01:51:30] Sahil: I believe all, all engineering is reverse engineering, right? Like you're, everyone learns, like, how do you learn English? You don't learn English by sitting there and saying, okay, A, B, C, D. Most people learn by just listening and trying to like reverse engineer what people are saying.

[01:51:46] Sahil: And the same thing is true.

[01:51:52] Sahil: What the fuck?

[01:51:57] Sahil: Okay. I mean, something, something's happening. [01:52:00] Uh,

Oh, spirits appeared,

you know,

[01:52:08] Sahil: whatever. I don't know what's going on, but this is it. Like, this is GTA six, you

[01:52:13] Ben: know,

[01:52:15] Sahil: basically just not as pretty. You'd have to hire a lot more people to build, but so

[01:52:21] Ben: yeah. Um, yeah, I don't think we've got time now to get jump into some of those other things, um, but. Yeah, I mean, Git

[01:52:30] Sahil: is simple.

[01:52:31] Sahil: Git is just like version control. So it's just a way of, basically you saw like when it makes a change.

[01:52:36] Ben: Yeah. Yeah.

[01:52:37] Sahil: Right. It just saves, it's a way of basically not rewriting the file. So you can like save your state and revert back to old states. Just like undo. It's just, all it is, is programming undo.

[01:52:48] Ben: Yeah.

[01:52:49] Sahil: So you can work with a team and not scare everyone from changing their code.

[01:52:54] Ben: Yeah. I think there's a few questions here that I think all have a similar theme, basically, which are like, do you think. Stuff like this brings out a wave of indie makers and like what that means, but sort of similarly Anyone can sort of build anything what of value is worth building and like, how do you get to that in the same vein?

[01:53:16] Ben: And like if people want to do this to do their own thing, whether it's for creating digital art or indie projects or whatever it is How would you think about that? Obviously, you've got a book and Other things that you've talked about stuff like this before it's not programming specific necessarily, but curious your thoughts

[01:53:37] Sahil: Yeah, I mean, I just think it's like basically I just think about who do you want to help?

[01:53:40] Sahil: You And what help do they need? Right? So, like, I wouldn't forget about art because art is not real, art doesn't exist. Uh, I would just think about, is there someone in your life who needs help? Uh, is there some [01:54:00] annoying thing that they have to do every day that should be automated? And then write a little bit of code to make it possible, right?

[01:54:07] Sahil: For me, it was a GPA calculator, right? Like, I wasn't building a GPA calculator for fucking fun. I was building it because I wanted to know what grades I would need in order to get into college. So I was solving my own problem, uh, and so that's why I think art is, is stupid. Like, no one, like, if you, if you have to ask, like, what art should I make?

[01:54:27] Sahil: Like, no, art is about, like, solve problems for people. Like, if you have a child who's crying, then you come up with a story in order to make them stop crying. That is art. It's just problem solving, so there's no even need to say art. Art is just something we say to like, appease people who are not really productive.

[01:54:47] Sahil: Uh, and so, it's just, just think about solving problems. That's the hard part. Like, coding is easy, uh, creating value is hard, right? Like, you still have to build something that people are going to pay for, and they're only going to pay for it if you're actually saving them time, energy, money. In droves, right?

[01:55:05] Sahil: Like, and that's very hard to do in a, in a, with software, frankly, like it's much easier to sell a cup of coffee and I'll pay 5 for it. Uh, but why would I pay for your software? Um, but yeah, I would, I would just focus on solving your own problems, solving problems for the people around you. Uh, like right now I'm thinking I'm designing a, uh, fountain.

[01:55:26] Sahil: I live in Dumbo and I think it would be cool if there was a fountain that people could use to fill up their water bottles. So I'm designing a fountain, you know, uh, and that's not hard to do. Like you just download blender and you design a fountain and it's not that hard to Google and ask AI, like how fountains work and.

[01:55:46] Sahil: Reverse engineer fountain. Uh, but the concept that we've covered today, like data structures for loops conditionals, that's all what I will be using in order to have a fountain, right? Because what is the fountain? The fountain is a data structure [01:56:00] that stores water and it has to store water in a certain unit.

[01:56:04] Sahil: And you have to use addition, multiplication, addition is really to like track the water level. And, you know, run a function whenever the water level gets too high and run a function whenever it gets too low and effectively just all you're doing is taking the bits and turning it into atoms. I would say the biggest thing I would recommend people do is like, spend less time on their computer and more time in the real world because that's where the problems are.

[01:56:29] Sahil: The problems in software are basically all solved at this point. So like almost all the problems are in the real world. It's like a train moves slowly. How do we make the train move faster? The train is too loud. How do we make it quieter? Um, you know, this road currently winds through these districts. Uh, how do we make it go straight so that people, you know, all the like real worlds is, is where the, where the impact really is.

[01:56:54] Sahil: And why is Elon, Elon, it's not because of Twitter, it's because of SpaceX and Tesla, right? Uh, no one would give a shit about Elon if he didn't have Tesla. So, uh, I would say focus on the real world. And now that software engineering has gone so easy. There's basically no value only in software engineering and people should be like when I went to school I didn't go to I went to school for one semester.

[01:57:16] Sahil: I went to school for electrical engineering, not software engineering, because software engineering is not really a skill. It's a fun thing that people do for fun, just like drawing, just like art, just like, you know, comics. What's real is electrical engineering, mechanical engineering, structural engineering.

[01:57:35] Sahil: So those are real. Um, and so I got lucky gun road is kind of a, it's kind of crazy that we get to be so successful. What without doing actual electrical engineering, but I would not use my story as an example, because the truth is like Peter levels and me and Danny Postma and people who actually make a living only off software.

[01:57:56] Sahil: I think is a dead breed. Like, no one, no one is going to be able [01:58:00] to do that. And then the proof is in the pudding, which is like how many people even already do it. There's not that many you can name. There's hundreds of thousands of people who see every single one of Peter Lovell's tweets and how many Peter Lovell's are there, right?

[01:58:16] Sahil: So AI won't make that any easier It'll make it harder because it'll only increase the number of competition you have and it's already so easy to build anything So personally, I think like yeah It's sort of like I would I would expand the skill set and the thing like coding isn't one of only one skill It's a tiny skill Uh, and math is a tiny skill, and English is a tiny skill, and you have to take all of these skills and learn all of these things, and then you can, like, build a new product, uh, you know, for, for, for people that actually solves, like, a really profound problem in their life that they're going to spend lots of money for, because if it's only programming, they'll do it themselves, if it's only English, they'll do it themselves, if it's only math, they'll do it themselves, so the value of what you're bringing into the bundle is incredible.

[01:59:00] Sahil: Of learning and knowledge and connectivity between all these things that when you pay for stripe, you're not just paying for one line of code that does a credit card, right? You're paying for economics and data structures and algorithms and probability of statistics. and business and finance and legal and ops and treasury management and legal and all sorts of complexity, uh, foreign exchange.

[01:59:25] Sahil: That's what you're, you're paying for. And that's why Stripe exists. Uh, if they only were doing what they were doing when they started, they'd be dead today. Right. Um, Which is why we keep building stuff at Gumroad, why we keep having new products like Flexile. com, Helper. ai, Ify. com, trying to keep pushing the envelope forward.

[01:59:44] Sahil: And if I were to show you like some of the stuff we're working on, like Helper, it looks like a normal customer support tool, but the one where the next version, the next iteration of, of Helper we're working on, uh, looks, it's going to look something more like this, which is like, you're just going to see the [02:00:00] conversations happening with AI, and then you're going to be able to like, basically take actions.

[02:00:05] Sahil: You know, in one, in using it, you know, something like that, uh, you know, you're going to only type, you know, refund the first two tickets, the others, and then you just hit boom, and it'll like that, like, everything is going to go off like a meta level of, of scale. Uh, so, yeah, anyway, that, that's. Maybe some helpful advice or not.

[02:00:36] Ben: Yeah. Well, I think that's great to uh, to end this, this session. It was really, it's really interesting. And yeah, I'm sure there's plenty of times where people were thinking where's this going? And then I think it all came together when we went through that. Um, and yeah, and if people are gonna use this and go and build stuff then tag us on Twitter and whatever else.

[02:00:55] Ben: Um, I'll get the recording up. However long it takes me to edit, um, though I'll just do cut off the beginning and just sort of upload the rest. Um, so yeah, I'll try and get that up later today, if not tomorrow. Um, but yeah, thanks so much, Sahil. Uh, we should do part two at some point.

[02:01:12] Sahil: Sounds good. Cheers everyone.

[02:01:14] Ben: Cheers. Bye. Yeah.

‍