학습주제: 오류 있는 코드를 디버깅하시오.
1. 디버깅 실습
디버깅 후, 실행결과가 하단의 출력결과랑 일치해야 한다
컴파일 오류뜨면 안됌.
Day 1 - String Manipulation
String Concatenation is done with the "+" sign.
e.g. print("Hello " + "world")
New lines can be created with a backslash and n.
print(Day 1 - String Manipulation")
print("String Concatenation is done with the "+" sign.")
print('e.g. print("Hello " + "world")')
print(("New lines can be created with a backslash and n.")
2. 실습 전, 자신이 짠 코드를 테스트 해보시오.
3. 잘못 디버깅한 코드와 실행결과
1)
print("Day 1 - String Manipulation/nString Concatenation is done with the '+' sign./ne.g. print('Hello'+'world')/nNew lines can be created with a backslash and n.")
⇒ \n 을 쓰지않고 줄바꿈을 /n 으로 써줘서 저렇게 출력이 돼었다.... ㅠㅠ \n 을 써줘야 한다.
2)
print('Day 1 - String Manipulation\nString Concatenation is done with the "+" sign.\ne.g. print('Hello'+'world')\nNew lines can be created with a backslash and n.')
⇒ print함수의 " ' 이것이 문자열 1단위로 인식되었고, 코드블럭이 부족했음.
3)
print("Day 1 - String Manipulation")
print("String Concatenation is done with the "+" sign.")
print('e.g. print("Hello " + "world")')
print("New lines can be created with a backslash and n.")
⇒ 2번째 행, "String Concatenation is done with the " 이렇게 한 문장,
" sign." 이렇게 한 문자열으로 인식해서 출력이 되었다.
⇒ String Concentenation is done with the sign 이렇게.. print 함수가 인식못한 + 라는 부호는 출력이 안되었음.
4. 다시 디버깅한 코드와 실행결과
1) 정답!
print('Day 1 - String Manipulation\nString Concatenation is done with the "+" sign.'"\ne.g. print('Hello'+'world')\nNew lines can be created with a backslash and n.")
2) 정답!
print("Day 1 - String Manipulation")
print('String Concatenation is done with the "+" sign.')
print('e.g. print("Hello " + "world")')
print("New lines can be created with a backslash and n.")
#유데미#유데미코리아#스타트위드유데미#스터디윗미