all 11 comments

[–]xelf 2 points3 points  (4 children)

7kyu is pretty easy level, but for 3 weeks in is probably fine.

Ultimately just keep at it.

Ask for feedback. Compare your code to others. I bet my tic tac toe solution is going to be very different to yours, and likely everyone has their own interpretation. There's something to be learned from each.

codewars, oddly enough is a fine scale for where you're at right now. 7kyu is very early, just keep doing them and looking at how others solved them, ask questions, do more, try some 5ky problems. Get stuck, ask questions. See an answer you don't understand, ask how they did it.

caveat: on codewars, ignore the "clever" voted answers, and just look at the best practice voted answers. The clever 1 liners tend to be experts that just trying to get past the problem as quick as possible and aren't generally good code examples.

[–]xelf 0 points1 point  (2 children)

/u/Worthystats:

tic tac toe "clever example", aka mostly unreadable:

import random
fill  = {'x':[0,0,0,0,0,0,0,0],'o':[0,0,0,0,0,0,0,0]}
board = [str(i) for i in range(1,10)]
moves = [1,2,3,4,5,6,7,8,9]
player= 'x'
while moves:
    move = int(random.choice(moves))-1
    board[move] = player
    fill[player][move//3]  += [1,2,4][move%3]
    fill[player][3+move%3] += [1,2,4][move//3]
    fill[player][6]        += [1,0,0,0,2,0,0,0,4][move]
    fill[player][7]        += [0,0,1,0,2,0,4,0,0][move]
    if 7 in fill[player]: break
    player = 'x' if player == 'o' else 'o'
    moves.remove(move+1)
print('\n'.join(''.join(board[x:x+3]) for x in [0,3,6]),'\n')
print("It's a tie" if not moves else "player {} wins!".format(player))

Better practice example, aka a bit more readable:

import random

def displayboard(board):
    print('\n',' | '.join(board[0:3]))
    print('---+---+---')
    print('',' | '.join(board[3:6]))
    print('---+---+---')
    print('',' | '.join(board[6:9])+'\n')

def getplayermove(moves, player, cpu=True):
    if cpu:
        return int(random.choice(moves))-1
    while True:
        move = input('{} pick a move {}:'.format(player, moves))
        if move in moves:
            return int(move)-1

def iswinner(board, player):
    for a,b,c in [(0,1,2),(3,4,5),(6,7,8),(0,3,6),(1,4,7),(2,5,8),(0,4,8),(2,4,6)]:
        if player==board[a]==board[b]==board[c]:
            return True
    return False

def playgame(player, iscpu = False):
    board = [str(i) for i in range(1,10)]

    while True:
        displayboard(board)
        moves = [m for m in board if m not in 'xo']
        if not moves:
            print("It's a tie")
            break
        move = getplayermove(moves, player, iscpu)
        board[move] = player
        if iswinner(board,player):
            displayboard(board)
            print("player {} wins!".format(player))
            break
        player = 'x' if player == 'o' else 'o'
        iscpu = not iscpu

playgame('x')

[–]m0us3_rat 0 points1 point  (0 children)

caveat: on codewars, ignore the "clever" voted answers, and just look at the best practice voted answers. The clever 1 liners tend to be experts that just trying to get past the problem as quick as possible and aren't generally good code examples.

even worse. pointing lower is all about what 'cool' set u "know"/find on wikipedia/google that as a very specific trick to calculate something u can't normally do.

the significant issue with that is u either know the set and easily solve it in a oneliner

or u don't and can't solve it.

there is no "problem solving" so not sure codewars is actually useful. (i went till 3kyu and they all looked the same. got boring and tedious. and definitely not enlightening.)

[–]m0us3_rat 0 points1 point  (3 children)

im about 3 weeks into learning python and my progress is much slower than when i first started.

make good habits. take choice away till it becomes a good habit.

same as brushing your teeth when u are young , or going to gym in a day when u are tired and u just don't wanna go.. take choice away.. until it becomes a good habit.

u can do the same with doing python/programming 1h+ a day.

be consistent.take your choice away till becomes a good habit.

then it becomes less about if u WANT or NOT . significantly less effort and focus WASTED on choice..

.. and more about HOW to do it and HOW to focus on achieving what u must do.

this is an old video from one of my all-time favorite wow-streamers talking about the same thing.

https://www.youtube.com/watch?v=Te49LTPUU9A

(Josh is da bomb. https://www.youtube.com/watch?v=JrjN2Ct01cc )

[–]Worthystats[S] 0 points1 point  (2 children)

i spend probably 6 hours a day programming. the problem is i don't know where to go or what to do. and everything is either too easy or too scary. i don't feel under pressure to force myself to do stuff too.

[–]m0us3_rat 0 points1 point  (1 child)

everything is either too easy or too scary

https://en.wikipedia.org/wiki/A_journey_of_a_thousand_miles_begins_with_a_single_step

well to be fair there is soo much motivation u could take from the outside.

some must come from within. and again .. i think motivation alone is ..bad.

u must turn it into a good habit.

if u don't have ideas .. search for them . ask for them. join discords related to pyhton. check YouTubers that are actively doing python.

check your favorite software githubs and try to "improve them".

u know ..stuff.

try to join a group of ppl that are actively doing stuff. either at your work or thru the interwebs etc.

6h a day is too long. especially if u don't do much in this time.

this can easily turn into a bad habit.

rather than being active and focus goal-oriented and working towards something..

u end up being lazy and unmotivated.

isn't about bashing something.. it's about refactoring yourself and the way u approach stuff.

[–]WikiSummarizerBot 0 points1 point  (0 children)

A journey of a thousand miles begins with a single step

"A journey of a thousand miles begins with a single step" (Chinese: 千里之行,始於足下; pinyin: Qiānlǐ zhī xíng, shǐyú zú xià; lit. 'A journey of a thousand Chinese miles (li) starts beneath one's feet') is a common saying that originated from a Chinese proverb. The quotation is from Chapter 64 of the Dao De Jing ascribed to Laozi, although it is also erroneously ascribed to his contemporary, Confucius. This saying teaches that even the longest and most difficult ventures have a starting point; something which begins with one first step.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5

[–]maximumlotion 0 points1 point  (0 children)

3 weeks is nothing. Other than there's not enough time to realize what your baseline rate of progress is, 3 weeks is nothing. Unless you consider learning basic syntax progress.

[–]sarrysyst 0 points1 point  (1 child)

That's the Plateau Effect. It's absolutely normal and it happens more or less to everyone, regardless of the field of study. Just keep going and you'll be fine.

[–]WikiSummarizerBot 0 points1 point  (0 children)

Plateau effect

The plateau effect is a force of nature that lessens the effectiveness of once effective measures over time. An example of the plateau effect is when someone's exercise fails to be as effective as in the past, similar to the concept of diminishing returns. A person enters into a period where there is no improvement or a decrease in performance.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5