티스토리 뷰

728x90
반응형

Python 부트 캠프 : 100개 프로젝트로 Python 공부!

1년여의 시간을 짬짬히 공부만 하고 나도코딩님 영상보며 출,퇴근 시간에 꾸준히 들었다.

기본편 , 심화 편을 공부 하면서 아... 이해가 잘가지 않는 부분이 반복적으로 생겨서

완전 기초 ! 완전 나는 아무것도 모른다는 생각으로 다시 시작해보자 하고 이렇게 포스를 한다.

이해 를 필요 할때는 나도코딩 님에 영상을 반복적으로 보면서 

단계별 응용이 필요할때는 과제형 코딩을 이어 가려 한다.

 

Day 1. 

print  문과 input 문을 사용하고 변수를 통해 입력값을 받아 출력하는 프로그램 작성

https://replit.com/@appbrewery/band-name-generator-end

위 링크 를 통해 repl.it  로 들어가 프로그램을 확인 해보고 똑같이 만들면 된다.

 난 이렇게 만들었다.

 

print("Welcome to the Band Name Generator.")
print("What's name of the city you grew up in?")
city_name = input()
pet_name = input("What's tour pet's name?\n")
print("Your band name coult be "+ city_name +" "+ pet_name)

결과만 같으면 되긴 하지만 이게 또 클린 코드 와 간결성이 초급자를 벋어나면 엄청 중요 해지기 때문에

쌤 의 정답 코드 는 

print("Welcome to the Band Name Generator.")
street = input("What's name of the city you grew up in?\n")
pet = input("What's your pet's name?\n")
print("Your band name could be " + street + " " + pet)

코드 줄이 한줄 줄었다 우선 내꺼 보다 한줄 줄고 아래에 내용은 같으니 나름 만족

Python Day 1. End

#1. Create a greeting for your program.
print("Welcome to the band name generator.")
#2. Ask the user for the city that they grew up in.
city = input("Which city did you grow up in?")
#3. Ask the user for the name of a pet.
pet = input("What's your pet's name\n")
#4. Combine the name of their city and pet and show them their band name.
print("Your band name could be " + city +" " + pet)

728x90
반응형

'Programming > Python' 카테고리의 다른 글

파이썬 기초 공부 - Hangman (행맨)  (0) 2022.12.21
Day 5. For , List , Random(Mathod/choice,shuffle)  (0) 2022.08.29
Day 4. Random , List , Sequence  (0) 2022.08.16
Day 3 . if / else  (0) 2022.08.05
Day 2 . Data type , f -string , Round  (0) 2022.08.02
댓글