Python Bootcamp 100 Days of Code

MihiCherub

Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    #Day_18 - Intermediate
    Turtle & the Graphical User Interface (GUI) (1hr 24min)



    මේ විදියට අසයින් කරන්න පුලුවන් පයිතන් වල විතරයි නේද?

    java වල එහෙම multiple assignment බෑනේ?
    ba third variable ekak one.
     
    • Like
    Reactions: Mandalorian

    Honda.putha

    Well-known member
  • Dec 26, 2017
    17,242
    29,818
    113
    #Day_18 - Intermediate
    Turtle & the Graphical User Interface (GUI) (1hr 24min)




    ba third variable ekak one.
    1625492481480.png

    Turtle gen oka adinna puluwanda?

    mama adapu ekak oya.

    meka?

    1625492592591.png
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    Day 20 - Intermediate
    Build the Snake Game Part 1: Animation & Coordinates (51min)

    Day 21 - Intermediate
    Build the Snake Game Part 2: Inheritance & List Slicing (50min)

    මේ project එක කරද්දි තමයි ඔන්න මුලින්ම මොලේට ගැටයක් වැටෙන්නෙ හිතල හිතල. දැන් තමයි අමාරු වෙන්නෙ. කොහෙන් ඩේට කොහොම එනවද කියල පැටලෙන්න ගන්නව. කොහොමද එහෙම method කෝල් කරන්නෙ. කොහොමද එහෙම run වෙන්නෙ වගේ ප්‍රශ්න ගොඩක් සෙට් වෙනව.

    Oo10WSb.jpg


    04 hours විතර ගියා. එකම project එක නිසා එක දවසෙම complete කලා. 3 days ahead දැන්.


    Code Challenge Inheritance:
    class 3ක් හදන්න. class 3නේ constructor 3 ඇතුලෙ print statement 3ක් දාන්න A,B,C කියල. (එක constructor එකක print statement එක බැගින්.)

    main එකේ එක class object එකක් විතරක් හදල constructor ඇතුලෙ තියෙන print statement 3 ම print කරල පෙන්නන්න. class Object එකයි හදන්න පුලුවන්.
     
    • Like
    Reactions: Honda.putha

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    අපිට list එකක් reverse loop කරන්න පුලුවන් මේ විදියට..
    Python:
    keys = [1,2,3,4,5,6]
    for key in reversed(keys):
        print(key)

    Python වල තියෙන්නෙ For each loop එකනෙ. ඒත් Java වලින් වගේ එනකෙනෙකුට index loop විදියටම loop කරන්න පුලුවන් මෙහෙම.
    Python:
    keys = [1,2,3,4,5,6]
    for i in range(len(keys)):
        print(keys[i])

    තව විස්තර ටිකක් කලින් දැන්ම
    http://elakiri.com/threads/python-bootcamp-100-days-of-code.1994705/post-26581414
     
    • Like
    Reactions: Honda.putha

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    #Day_22 - Intermediate
    Build Pong: The Famous Arcade Game (53min)
    මම තනියම ටිකයි කලේ. කාලෙ අපරාදෙ නිසා. මේව කොච්චර මහන්සි වෙලා හැදුවත් මෙහෙම මතක හිටින්නෙ නෑ ආපහු turtle class එකෙන් වැඩක් ගද්දි. ඒ නිසා tutorial එක බලන් ඉතුරු ටික හදාගත්ත දැනුමට.

    #Day_23 Skipped..
    turtle class එක ඇතිවුනා, Graphics වලින් ලොකු දේවල් ඉගෙනගෙන වැඩක් නෑ මගේ අවශ්‍යතාවයට. නිදහස් වෙලාවක කරනව. turtle class එක learning purpose එකට විතරක් තියෙන class එකක් විදියට තමා ගොඩක් article වල කියන්නෙ.
     
    • Like
    Reactions: Honda.putha

    thomian

    Well-known member
  • May 20, 2011
    12,048
    16,799
    113
    Machan, Hurdle 4 eke mata awe me wage code ekak.. solution eke tiyana ekata wada tikak wenas.. any comments ?

    1625712371563.png


    Python:
    def turn_right():
        turn_left()
        turn_left()
        turn_left()
    
    def move_robot():
        if front_is_clear():
           move()
        if not wall_on_right():
           turn_right()
        if wall_in_front():
           turn_left()   
            
    while not at_goal():
        move_robot()
     

    Honda.putha

    Well-known member
  • Dec 26, 2017
    17,242
    29,818
    113
    Machan, Hurdle 4 eke mata awe me wage code ekak.. solution eke tiyana ekata wada tikak wenas.. any comments ?

    View attachment 134346

    Python:
    def turn_right():
        turn_left()
        turn_left()
        turn_left()
    
    def move_robot():
        if front_is_clear():
           move()
        if not wall_on_right():
           turn_right()
        if wall_in_front():
           turn_left()  
           
    while not at_goal():
        move_robot()
    වැඩේ නම් වෙනවා. ඒත් එග්සාම්පල් එක තියෙන්නෙ වයිල් ලූප් එක පුරුදු වෙන්න නේද?
     
    • Like
    Reactions: thomian

    thomian

    Well-known member
  • May 20, 2011
    12,048
    16,799
    113
    වැඩේ නම් වෙනවා. ඒත් එග්සාම්පල් එක තියෙන්නෙ වයිල් ලූප් එක පුරුදු වෙන්න නේද?
    :yes::yes: ow machan..while eka use karala gahuawa nam hari.. eka sarema oluwata we me code eka :rolleyes:
     
    • Like
    Reactions: Honda.putha

    Honey Bunch

    Well-known member
  • Nov 24, 2018
    16,967
    26,379
    113
    Kandy
    1. සිප් කරල නැති නිසා ඔක්කොම එක පාර බාගන්න ඕනෙ නෑ. අදාල දවසට ඔනෙ ටික විතරක් බාගන්න පුලුවන්. එහෙම ටොරන්ට් එකක් බාගන්න දන්නෙ නැත්නම් අහන්න.
    meka kiya denna pluwanda

    Thank you
    ------ Post added on Jul 9, 2021 at 4:04 AM