본문 바로가기
개발일지/Python

2022.01.21 Day-7-1 유데미 파이썬 심경변화 행맨게임1

by 개발에정착하고싶다 2022. 1. 21.
320x100
유데미의 Day7 역시 나를 자괴감에 빠뜨리게 하기에 충분했다.
정말 이렇게 하다보니

 

"이렇게 하는게 맞는건가?"
"못해도 너무 못하는거 아닌가?"
라는 생각이 들었다.
 
아니 그러면 뭐 어쩌려고 이제와서 발빼려고?
이제 내 인생에 그딴건 없다.
최소한 전환을 하더라도 일정 분기점에선 찍어줘야지
심지어 안맞아서 중간에 그만두는것도 아니고 몰라서 그런거면
주입식으로 우겨넣어서라도 할줄알게 만들어야지 싶다.
 
때문에 때로는 생각하며 고민하고 하되, 이처럼 일정 연속텀으로
생각은 고사하고 손도댈 수 없는 그런게 나오면 그냥 닥치고 다 배끼고 따라하고
코드를 까보는것에만 집중하기로 했다.
자괴감을 겪고 있는 자신조차 아깝다
 
배운적없고 체득한적 없는걸 모르는건 당연한것이고
당연한것을 당연하게 받을줄도 알아야지.
나 자신을 이겨가는 과정에 있다.

한 번으로 모자라면 두 번하면되고 두 번해서 모자라면 세 번하고

그걸 반복하면 뭐 언젠간 해내지 않겠나? 생각한다.

언제까지 징징대고 있을거냐

징징대면 뭐가 달라지고 누가 책임지냐

결국 책임은 내가지는건데 뭔 개짓을 하고 있는거냐

징징대지 말고 할것을 해라.

 

#Step 2

 

import random
word_list = ["aardvark", "baboon", "camel"]
chosen_word = random.choice(word_list)

 

#Testing code
print(f'Pssst, the solution is {chosen_word}.')

 

#TODO-1: - Create an empty List called display.
#For each letter in the chosen_word, add a "_" to 'display'.
#So if the chosen_word was "apple", display should be ["_", "_", "_", "_", "_"] with 5 "_" representing each letter to guess.
display = []
word_length = len(chosen_word)
for _ in range(word_length):
display += "_"
print(display)
guess = input("Guess a letter: ").lower()

 

#TODO-2: - Loop through each position in the chosen_word;
#If the letter at that position matches 'guess' then reveal that letter in the display at that position.
#e.g. If the user guessed "p" and the chosen word was "apple", then display should be ["_", "p", "p", "_", "_"].
for position in range(word_length):
letter = chosen_word[position]
if letter == guess:
display[position] = letter
 

 

#TODO-3: - Print 'display' and you should see the guessed letter in the correct position and every other letter replace with "_".
#Hint - Don't worry about getting the user to guess the next letter. We'll tackle that in step 3.

 

print(display)

 

300x250