අනාත programmers ලා.

ThisaraMalintha

Well-known member
  • Nov 16, 2015
    8,612
    7,331
    113
    ගෙදර
    Angry Tv Land GIF by Teachers on TV Land
    leo-meme-face-mask-1834.jpg
     

    hancok

    Well-known member
  • Aug 16, 2008
    36,592
    19,044
    113
    පිළි-ඇඳි-දොළ
    ubalata me problem eka dunnoth code interview ekaka kisima deyak nokiya uba karanne kohomada?

    search_item eke index eka print karanna. me language 2n kamati language 1k select karaganna
    Java:
    int search_item = 33;
    int numbers[] = {10, 14, 19, 26, 27, 31, 33, 35, 42, 44};
    Python:
    search_item = 33
    items = [10, 14, 19, 26, 27, 31, 33, 35, 42, 44]
    Python:
    wesi = 33
    items = [10, 14, 19, 26, 27, 31, 33, 35, 42, 44]
    
    douglas = 0
    kanthi  = len(items)
    
    while 1<2:
        pons = int((douglas+kanthi)/2)
        if wesi > items[pons]:
            douglas = pons
        elif wesi == items[pons]:
            print(pons)
            exit()
        else:
            kanthi = pons
     

    Natsu_Drag001

    Well-known member
  • Apr 29, 2018
    863
    833
    113
    Kingdom of Fiore
    ubalata me problem eka dunnoth code interview ekaka kisima deyak nokiya uba karanne kohomada?

    search_item eke index eka print karanna. me language 2n kamati language 1k select karaganna
    Java:
    int search_item = 33;
    int numbers[] = {10, 14, 19, 26, 27, 31, 33, 35, 42, 44};
    Python:
    search_item = 33
    items = [10, 14, 19, 26, 27, 31, 33, 35, 42, 44]
    meka nm Binary search eken godadanna puluwan ordered nisa.

    And there are many ways to get the outcome in Java (unordered list)

    Ex: Guava - Java-based library developed by Google

    import com.google.common.primitives.Ints;

    Ints.indexOf(numbers, 33);
     

    ජොසී

    Well-known member
  • May 29, 2014
    5,206
    4,453
    113
    Padavi Sripura
    මා සත්‍ය හරි හැටි දනිමි
    එය නිතර පවසාද ඇත්තෙමි
    පවසා මෙහි කිච වීද ඇත්තෙමි
    කිසිවක් පැවසීමට හිතක් නැත්තෙමි

    හිත රිදෙන කතා බොහොමයි
    කීමට හිත නිතර නලියයි
    ලංකාවෙ පඩ්ඩන් හරි සුලබයි
    රියල් වැඩ්ඩො හරි දුලබයි

    ප්‍රොග්‍රැමින් ඇම්ම කුඩා කල සිට
    ඇති එකා නොලබයි වරම් වාසිටියට
    දිස්ත්‍රික් කොටා සහ ඉසෙඩ් අගයට
    කොහෙවත් උන් සිලෙක්ට් වෙයි හරියට

    ඉහල තලයෙ වැටුප් තිබෙන නිසා
    හිත හැදෙන පට්ටම් එමට ඇති නිසා
    ගෙව හො නොගෙවා සුදුසුකම් තකා
    ආසා නැති උනත් එයි උන් පොර කකා
    කතාව ඇත්ත. මට හම්බුන real වැඩ්ඩොත් ගොඩක්ම දැන් එක එක රටවල.
     
    • Like
    Reactions: JohnSnow

    brayan.perera

    Active member
  • Mar 15, 2010
    101
    88
    28
    පයිතන් කොඩ් සාම්පල් එක

    1. Start print

    Python:
    def print_stars(x, y):
        for i in range(0, y):
            print(' '.join(['*' for u in range(0, x)]))
    
    print_stars(5, 5)

    2. Search index (duplicates)
    Python:
    search_item = 33
    a = [10, 14, 19, 26, 27, 31, 33, 35, 42, 44, 33]
    if search_item in a:
        for i in range(len(a)):
            if a[i] == search_item:
                print(i)
     
    Last edited:

    hasithayad

    Well-known member
  • Sep 28, 2011
    30,793
    1
    44,996
    113
    Java:
    public class demo {
        public static void main (String args[]) {
            for (int i = 0; i < 5; i++) {
                for (int j = 0; j < 5; j++) {
                    System.out.print("*");
                }
                System.out.println();
            }
        }
    }
    line break එකක් දාල එක loop එකෙන්ම ඕක ගොඩදාන්න පුලුවන්නෙ බන් :rolleyes:
     

    amila2d

    Active member
  • Sep 20, 2008
    110
    27
    28
    පෙන්නන බැරි ගිය ගමන් ආ කෝඩින් කරපන් කියලා ප්‍රොජෙක්ට් එකක් දෙනවා උන් හිතන් ඉන්නේ අපි මේවා මේ කටපාඩම් කරන් එනවා කියලා . අඩුම සතියක හරි පොඩි ප්‍රොජෙක්ට් එකක් දීලා ගූගල් එකේ පීනල හරි ප්‍රොජෙක්ට් එක කරලා ඩිස්ක්‍රයිබ් කරන්න කිව්වනම් තමා හොද . ඩිස්ක්‍ර්ප්ශන් එක කරන එකෙන් තේරෙනවා මනුසයගේ කෝඩින් දැනුම සහ ඇප්ලයි කරන එක. ගොඩක් පිට රට රස්සාවල් වල කරන්නේ මේක. ලංකාවේ පොරවල් හිතන් ඉඉන්නේ කෝඩ් කටපාඩම් කරන් ඉන්නේ කියලා පිස්සු හුත්තෝ. ත්‍රෙඩ් එක දාපු එකත් ඒ වගේ. සුපිරි වැඩඩෙක් හරි ජීවිත නැති IT කාරයො නම් ඕම දුන්න ගමන් ලියන් යනවා බහුතරයට බෑ.
    I also agreed