Python Bootcamp 100 Days of Code

Voltage

Well-known member
  • Feb 6, 2012
    21,722
    1
    15,120
    113
    @MihiCherub මේකෙ බිංදුවේ ඉදන් කියල දෙනවද. මට programming සාමාන්‍යයෙන් පුලුවන්. job එක විදියට programming කරන්නේ නෑ. මගේ ජොබ් එකටත් Python වැදගත් වෙනව ඉස්සරහට එන trends හැටියට. කරගන්න ඕන මේක
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    age kathandare mokakda
    samahara job requirement wala age limit ekak enawane ban. experience eka illana level ekakuth enawa. ithin oya dekama thiyenne one. age limit ekak nath nam experience illana level eka thiyenawa nam awlak na.

    @MihiCherub මේකෙ බිංදුවේ ඉදන් කියල දෙනවද. මට programming සාමාන්‍යයෙන් පුලුවන්. job එක විදියට programming කරන්නේ නෑ. මගේ ජොබ් එකටත් Python වැදගත් වෙනව ඉස්සරහට එන trends හැටියට. කරගන්න ඕන මේක
    ඔවු 0 ඉදන් කියල දෙනව. experience තිබ්බත් 0 ඉදන්ම කරන්න දවසට පැය 2ක් හොයන්. මම job එක විදියට java programming කරලත් 0 ඉදන්ම කරනව. ඒක වටිනව
     
    • Like
    Reactions: hchri and Voltage

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    #Day_04
    Randomization and Python Lists (1hr 21min)

    last exercise repl.it forked students 39,748

    Python random Module
    https://www.askpython.com/python-modules/python-random-module-generate-random-numbers-sequences

    Python Data Structures
    https://docs.python.org/3/tutorial/datastructures.html

    Day 04 project
    Rock Paper Scissors Game.. Sample Code

    Python:
    import random
    rock = '''
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
    '''
    
    paper = '''
        _______
    ---'   ____)____
              ______)
              _______)
             _______)
    ---.__________)
    '''
    
    scissors = '''
        _______
    ---'   ____)____
              ______)
           __________)
          (____)
    ---.__(___)
    '''
    
    gestures = [rock, paper, scissors]
    selection = [0,1,2]
    
    human_choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors\n"))
    computer_choice = random.choice(selection)
    #computer_choice = random.randint(0, 2)
    
    print(gestures[human_choice])
    print("Computer chose:")
    print(gestures[computer_choice])
    
    if human_choice == computer_choice:
      print('Draw')
    elif human_choice == 0 and computer_choice == 2:
      print('You Win')
    elif human_choice == 1 and computer_choice == 0:
      print('You Win')
    elif human_choice == 2 and computer_choice == 1:
      print('You Win')
    else:
      print("You lose")

    ----------------------------------------------------
    #Day_05
    Python Loops (59min)

    0XnWu2q.jpg


    last exercise repl.it forked students 39,719

    Fizzbuzz game sample code..

    Python:
    for number in range(1,101):
      if number % 15 == 0: #smallest common multiplication
        print('FizzBuzz')
      elif number % 5 == 0:
        print('Buzz')
      elif number % 3 == 0:
        print('Fizz')
      else:
        print(number)
     
    Last edited:

    Tharaka25

    Well-known member
  • Feb 12, 2018
    2,613
    2,230
    113
    me course ekath karanna asai. eth me tike js ivara karala dan react igena gannava. godak ewa allagaththahama ekakvath kerenne nahane. hoda react courses danna kattiya kiyanna mata.
     
    • Like
    Reactions: MihiCherub

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    me course ekath karanna asai. eth me tike js ivara karala dan react igena gannava. godak ewa allagaththahama ekakvath kerenne nahane. hoda react courses danna kattiya kiyanna mata.
    andre ge course try karanna..
    day 5 bump
    day 04 eke bump ekak thibbe na. day 05 dapu post eka day 04 post ekata merge una.
    kohomada meka part part wena wenama download karanne?
    JvgARSR.jpg


    torrent eka add karaddi one files tika withara tick karala ithuruwa uncheck karanna. ita passe apahu one weddi me widiyata download karanna
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    #Day_06
    Python Functions & Karel (1hr 23min)

    Built-in Functions​

    https://docs.python.org/3/library/functions.html

    PEP 8​

    https://www.python.org/dev/peps/pep-0008/

    අද lesson එකේ පට්ට interesting සයිට් එකක් සෙට් උනා. try එකක් දීල බලන්න. ගොඩක් දේවල් ඉගෙන ගන්න පුලුවන්.
    https://reeborg.ca/index_en.html

    last challenge එකේ 2nd stage debug කරපු කෙනෙක් ඉන්නවද? මට නම් බැරි උනා.. පට්ට fun..
     
    • Like
    Reactions: shenat

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    #Day_7 (57min)

    Python Lists​

    https://developers.google.com/edu/python/lists#for-and-in

    මේ ගොඩක් tutorial වල අපිට තියෙන ඔක්කොම Built-in Functions ටික කියන්නෙ නෑ. සමහරු කරන tutorial වල පට්ට පජාත විදියට කරන්නෙ. ඔය ගොඩක් බාගෙට දැනන් හදන ඉන්දියන් උන්ගෙ tutorial එහෙම හෙන ප්‍රාථමිකයි.
    අපි Built-in Functions වෙනම හොයාගන්න ඕනෙ. මේ lesson එකෙත් solution 2 එකේ අපිට list එකක index එක ගන්න ඕනෙ නම් වෙනම variable හදන්න ඕනෙ නෑ. Built-in Functions තියෙනව.

    Ex - List එකක් තියෙනව නම් ඒ List එකේ තියෙන values ටික index එකත් එක්ක print කරන්න ඕනෙ නම් ගොඩක් අය කරන්නෙ මෙහෙම

    Python:
    fruits = ['Apple', 'Orange', 'Pineapple', 'Lime', 'Mango']
    index = 0
    for fruit in fruits:
        print(index, fruit)
        index += 1

    ඒත් මේකට Built-in Functions තියෙනව.
    Python:
    fruits = ['Apple', 'Orange', 'Pineapple', 'Lime', 'Mango']
    
    for index,fruit in enumerate(fruits):
        print(index, fruit)
    
    # if index need to be start with different number
    for index,fruit in enumerate(fruits, start=2):
        print(index, fruit)

    list දෙකක් loop කරන්න ඕනෙ වෙලාවට

    Python:
    names = ['Bimal', 'Kasun', 'Nimal', 'Sunil', 'Aruna']
    fruits = ['Apple', 'Orange', 'Pineapple', 'Lime', 'Mango']
    
    # if need to loop over both lists at the same time
    for name,fruit in zip(names, fruits):
        print(f'{name} is likes {fruit}')
    
    # if need to loop over both lists at the same time but get values in single tuples
    for values in zip(names, fruits):
        print(values)
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha


    ada neh dekke. ada ree idan math join wennm.
    me keeweni dawasada?

    Bump

    Math bagena na yanne dan


    මාත් අද buy කරා 11.99$ . හෙට ඉදන් වගේ සෙට් වෙන්න හදන්නෙ.

    downloaded
    puluwan welawata bump ekak danna. nath nam ilaga dawase update karanna ba. eka laga comment 2k danna bari nisa..
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    First week එක ඉවර වෙද්දි repl forked students 23,711

    AjVJ5lc.jpg


    TIP 1
    Python වල string එකක් store කරද්දි අපිට single quote, double quote වගේ single or double quote 3ක් use කරන්න පුලුවන්. එහෙම quote 3ක් use කරද්දි character escape කරන්න ඕනෙ නෑ. single or double quote 3 ඇතුලෙ අපිට පහසුවෙන් single quote, double quote use කරන්න පුලුවන්
    Python:
    sample_string = '''You're beautiful. "Hello There"'''
    >>> You're beautiful. "Hello There"

    TIP 2
    Python වල string multiplication කරන්න පුලුවන්.
    Python:
    value = "*" * 5
    >>> *****

    ඔන්න ඔය ක්‍රමෙන් අද තිබ්බ Hangman game code එකේ String එක List එකක් කරල ආයිත් String එකක් කරන මේ Code කෑල්ල
    Python:
    #Create blanks
    display = []
    word_length = len(chosen_word)
    for x in range(word_length):
        display.append('_')
    blank_word = ''.join(display)

    මෙහෙම ලියන්න පුලුවන්.
    Python:
    blank_word= '_' * len(word)
     

    thomian

    Well-known member
  • May 20, 2011
    12,048
    16,800
    113
    මමත් පටන් ගත්තා මචං.. දැන් තියෙන්නේ Day 3 - Control Flow and Logical Operators.

    මම python කරන්නේ Automation වලට (selenium / RestAPI / Appium). මීට අමතරව security etc
     
    Last edited:

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,849
    1
    9,594
    113
    Gampaha
    Day 07 එකේ අලුත් lesson එකක් නෑ. කලින් ඉගෙන ගත්ත ඒව revision කරල ගේම් එකක් හදන්න තිබ්බ නිසා මම Day 08 එකත් ඊයෙම කලා. පෝයයි රට වහලත් නිසා වෙලාවත් තිබ්බ.

    #Day_08
    Function Parameters & Caesar Cipher (1hr 24min)

    Alphabet එකක් හදාගන්න පුලුවන් මේ විදියට. ඔක්කොම letters manually add කරන්නෙ නැතුව.

    Python:
    alphabet = list(string.ascii_lowercase)
    alphabet = list(string.ascii_uppercase)
    alphabet = list(string.ascii_letters)

    Code:
    >>> help(string) # on Python 3
    ....
    DATA
        ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
        ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
        ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
        digits = '0123456789'
        hexdigits = '0123456789abcdefABCDEF'
        octdigits = '01234567'
        printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
        punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
        whitespace = ' \t\n\r\x0b\x0c'

    #Day_09
    Dictionaries, Nesting and the Secret Auction (1hr 2min)

    TIP
    While loop එකක් end කරන්න Dr. Angela කරන විදියට නැතුව අපිට Break use කරල end කරන්න පුලුවන්.
    Python:
    is_finished = False
    while not is_finished:
        # Do some stuff
        if check_condition:
            is_finished = True

    Break use කරල

    Python:
    while(True):
        #Do some stuff
        if check_condition:
            break

    100 milestone එක reach කලා අද. 15% complete.

    y6Lz8LK.jpg
     
    Last edited: