How to Learn to Code



source

50 thoughts on “How to Learn to Code”

  1. @craftgirlU says:

    We have scratch on grade four science for some reason

  2. Nuhh you lost me at python ✌😩🀣🀣

  3. @OG-DashFlex says:

    The tall perspective is actually pretty fire

  4. @arunbadmash says:

    i love coding and i am going to start coding because it is so fun and relaxing and letting your creativity grow and making games coding is my dream since i was 6years old and i have been waiting to get older and i am 9years old now and i am going to start coding now

  5. we had scratch on grade 4 and python last year, its true Gohar, is easy! Thank you!

  6. @2DEssaly says:

    Funny, just use AI

  7. Guys i built a ai called apex with code

  8. You don’t crash out coding the backend? I understand that you crash out with the front end but yeah.

  9. @JolttLogic says:

    I love coding 😘

  10. @IbraNabel says:

    Is learning luau good so I can code Roblox games, I know how to code it but moving to python just confuses me because it's so different?

  11. My code for dino run

    #include <SPI.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_ST7789.h>

    #define TFT_CS 15
    #define TFT_DC 2
    #define TFT_RST 4
    #define TFT_BL 32
    #define BUTTON 0

    Adafruit_ST7789 tft(TFT_CS, TFT_DC, TFT_RST);

    #define BG ST77XX_BLACK
    #define FG ST77XX_WHITE

    const int GROUND = 112;
    const int DINO_X = 25;

    float dinoY = 86;
    float velocity = 0;
    float cactusX = 260;
    float speed = 4.5;

    int score = 0;
    int highScore = 0;
    int frame = 0;
    int cloud1 = 40;
    int cloud2 = 170;
    int obstacleType = 0;

    bool gameOver = false;
    bool wasPressed = false;
    bool jumping = false;

    void drawDino(int x, int y) {
    // Body
    tft.fillRect(x + 5, y + 9, 15, 11, FG);
    tft.fillRect(x + 13, y + 2, 10, 12, FG);
    tft.fillRect(x + 19, y + 5, 9, 7, FG);
    tft.fillRect(x, y + 13, 7, 4, FG);

    // Eye
    tft.drawPixel(x + 21, y + 5, BG);

    // Animated legs
    if (frame % 2 == 0 && !jumping) {
    tft.fillRect(x + 8, y + 19, 5, 6, FG);
    tft.fillRect(x + 17, y + 17, 5, 8, FG);
    } else {
    tft.fillRect(x + 8, y + 17, 5, 8, FG);
    tft.fillRect(x + 17, y + 19, 5, 6, FG);
    }
    }

    void drawCactus(int x) {
    tft.fillRect(x + 5, 88, 7, 24, FG);
    tft.fillRect(x, 96, 5, 8, FG);
    tft.fillRect(x - 3, 96, 4, 4, FG);
    tft.fillRect(x + 12, 93, 5, 9, FG);
    tft.fillRect(x + 12, 93, 4, 4, FG);
    }

    void drawBird(int x, int y) {
    tft.fillRect(x, y, 18, 5, FG);
    if (frame % 2 == 0) {
    tft.drawLine(x + 3, y, x + 8, y - 6, FG);
    tft.drawLine(x + 8, y - 6, x + 13, y, FG);
    } else {
    tft.drawLine(x + 3, y + 4, x + 8, y + 9, FG);
    tft.drawLine(x + 8, y + 9, x + 13, y + 4, FG);
    }
    }

    void drawCloud(int x, int y) {
    tft.fillCircle(x, y, 5, FG);
    tft.fillCircle(x + 7, y - 3, 7, FG);
    tft.fillCircle(x + 15, y, 5, FG);
    tft.fillRect(x, y, 15, 5, FG);
    }

    void drawGround() {
    tft.drawLine(0, GROUND, 240, GROUND, FG);
    for (int i = 0; i < 240; i += 35) {
    tft.drawPixel(i, 119, FG);
    tft.drawPixel(i + 10, 117, FG);
    }
    }

    void drawScore() {
    tft.fillRect(155, 3, 83, 23, BG);
    tft.setTextColor(FG);
    tft.setTextSize(1);
    tft.setCursor(158, 5);
    tft.print("HI ");
    tft.print(highScore);
    tft.setCursor(158, 16);
    tft.print("SCORE ");
    tft.print(score);
    }

    void restartGame() {
    dinoY = 86;
    velocity = 0;
    cactusX = 260;
    speed = 4.5;
    score = 0;
    frame = 0;
    obstacleType = 0;
    gameOver = false;
    jumping = false;

    tft.fillScreen(BG);
    drawGround();
    drawCloud(cloud1, 35);
    drawCloud(cloud2, 50);
    drawDino(DINO_X, 86);
    drawCactus(260);
    drawScore();
    }

    void gameOverScreen() {
    tft.fillRect(35, 30, 175, 70, BG);
    tft.setTextColor(FG);
    tft.setTextSize(2);
    tft.setCursor(43, 35);
    tft.print("GAME OVER");

    tft.setTextSize(1);
    tft.setCursor(80, 62);
    tft.print("SCORE: ");
    tft.print(score);

    tft.setCursor(60, 85);
    tft.print("BOOT TO RETRY");
    }

    void setup() {
    pinMode(TFT_BL, OUTPUT);
    digitalWrite(TFT_BL, HIGH);
    pinMode(BUTTON, INPUT_PULLUP);

    tft.init(135, 240);
    tft.setRotation(1);
    tft.fillScreen(BG);

    tft.setTextColor(FG);
    tft.setTextSize(2);
    tft.setCursor(35, 45);
    tft.println("DINO RUN");

    delay(1000);
    restartGame();
    }

    void loop() {
    bool pressed = digitalRead(BUTTON) == LOW;
    bool newPress = pressed && !wasPressed;
    wasPressed = pressed;

    if (gameOver) {
    if (newPress) restartGame();
    delay(20);
    return;
    }

    if (newPress && dinoY >= 86) {
    velocity = -8.5;
    jumping = true;
    }

    float oldY = dinoY;
    float oldX = cactusX;

    velocity += 0.45;
    dinoY += velocity;

    if (dinoY >= 86) {
    dinoY = 86;
    velocity = 0;
    jumping = false;
    }

    cactusX -= speed;

    if (cactusX < -20) {
    cactusX = 240 + random(30, 100);
    score++;
    speed += 0.15;
    obstacleType = random(0, 2);
    }

    // Collision detection
    if (cactusX < DINO_X + 25 &&
    cactusX + 17 > DINO_X + 5 &&
    dinoY + 23 > 88) {
    gameOver = true;
    }

    // Clear old dinosaur and obstacle positions
    tft.fillRect(DINO_X - 3, (int)oldY - 8, 35, 38, BG);
    tft.fillRect((int)oldX - 5, 75, 30, 40, BG);

    // Move clouds
    cloud1--;
    cloud2--;

    if (cloud1 < -20) cloud1 = 245;
    if (cloud2 < -20) cloud2 = 245;

    // Draw scene
    drawCloud(cloud1, 35);
    drawCloud(cloud2, 50);
    drawDino(DINO_X, (int)dinoY);

    if (obstacleType == 0) {
    drawCactus((int)cactusX);
    } else {
    drawBird((int)cactusX, 88);
    }

    drawGround();
    drawScore();

    frame++;

    if (score > highScore) {
    highScore = score;
    }

    if (gameOver) {
    gameOverScreen();
    }

    delay(25);
    }

  12. I learnt scratch first now I am learning web development πŸ₯‡ πŸ•ΈοΈ

  13. Ooo when u like the like heart become a light bulb for a second πŸ˜ƒπŸ˜ƒ

  14. @coolqwertin says:

    We shaw the prompt box

  15. Was i the only one who did not understand scratch?

  16. I’m still learning python

  17. Bro i saw his bother on the full tutorial of python cs50 on youtube video

  18. As a one-year roblox developer, I still use a plugin for free on ribkix studio called BlockLua. Yes, it still includes the lua stuff, with a whopping 8000+ blocks, so yeah.

  19. We are living in the past they are coding with ABCs and 123s πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚code using symbols a picture is worth a thousand words

  20. C++ was my first languege. I am suffering rn. Btw i will learn python after c++. I use arch btw

  21. Buddy im a c++ programmer i dont need your baby steps

  22. @HoodhShfaf says:

    i learn Hdml & java

  23. @Flashpierce says:

    You can make coding understandable. But understandability doesn't translate to line code.

    coding depending entirely on line logic to input those instructions to the computer.

    I've made 4 projects now. Working on my fifth. I'm going going to release 2 to Google play next year.

    You can explain computer science and whatnot but unless they are curious in line logic and syntax then those concepts you teach them won't magically convert it some line logic

    Also python .

    It's easy to read sure

    But it is disgusting. It has zero structure.

    you don't know when an class ends or even begins for that matter.

    It's only good for one time block thing. Usually an short script (like what I did for MittensEternal, the first 4000 elo engine in the world). But that's it.

    If they can read python. upgrade them to java. Far far better. Yes more focused on variables. But it gives you more control over what you are telling the computer. If there's an error. You know which block it is in.

  24. @GhxstFx00 says:

    i wanna learn to code but ai does it so well and soon it will probably be better than humans is it still worth learning how to do it i wanna learn c#

  25. Guys coding in the ams tool is best I think guys

  26. @slimak1278 says:

    Unpopular opinion: Javascript is the easiest programming language, with the easiest syntax, because you don't need to be extremely careful with all the indents for example. Also not to mention, to build a real app in Python (not console one), you need to learn some libraries, meanwhile basic Javascript (the one you use in browser) already lets you build real non console apps with the help of HTML and CSS

  27. @Mr_dodge2 says:

    If you use html it’s more advanced than python

  28. Don't worry I have an idea just use mimo it's like Duolingo but for coding and it's free

  29. @Mr.Robloxia says:

    I just started coding!

  30. @its_adilab says:

    trying to learn coding on youtube is a trap with all these recommendations... quietube on my android has been saving my focus lately

  31. @Chea-coding says:

    Python so hard to Learn For me 😒

  32. I started with c++ πŸ’€πŸ’€

  33. @hello099-c says:

    "scratch is simple"
    have you seen what griffpatch is making😭

  34. @AyuHereToo says:

    Coding is one of the coolest thing

  35. bros right even a 10 yr old like me make a whole code to make jarvis from Iron ManπŸ’€

  36. @robod1378 says:

    the only reason i don't actually code is because i don't get the motivation

  37. I do scratch I’m a 9 yo old (idk why I’m here)

  38. @LUMIERE-m5r says:

    bro is secretly violating his brothers πŸ‘οΈπŸ‘οΈ
    πŸ‘„

  39. Me and my buddies built an entire chat system that is local, GUIless, serverless, decentralized, encrypted and hidden from common mitm.

  40. @juno-n1v says:

    I did it when I was 5 years old

  41. @aspidhell3 says:

    I learned through javascript. Its easy for my ADHD mind and force me to stay organized (whicj is a struggle so its good)

  42. I hate scratch because I think it's somehow the hardest of all of them and I can code a lot of languages I also tried assembly for a time and it was easier

  43. @velnorer says:

    The only coding language i know is minecraft commands (or datapacks)

Leave a Reply

Your email address will not be published. Required fields are marked *