[Python Examples] 파이썬 리스트 예제: 특정 원소 또는 값 찾기
파이썬 리스트 예제: 특정 원소 또는 값 찾기 포스트 난이도: HOO_Intern # Example Code def find_HOO(x): if "HOO" in x: print("HOO is here!") else: print("HOO is not here.") list1 = [15.6,"Wally",54,"Osvaldo"] list2 = ["Wald","HOO",6] list3 = [1,2,3,4,5,6,7,8,"HOO",10,11] print("List1: ") find_HOO(list1) print("List2: ") find_HOO(list2) print("List3: ") find_HOO(list3) List1: HOO is not here. List2: HOO is here! List3: HO..
2022. 10. 7.
[Python Examples] print(sep=) 예제 코드, print(mm,dd, yyyy, sep='-')
print(sep=) 예제 코드, print(mm,dd, yyyy, sep='-') 포스트 난이도: HOO_Intern # Python Example Codes mm='09' dd='28' yyyy='2022' print(mm,dd, yyyy, sep='-') print(mm,dd, yyyy, sep='/') print(mm,dd, yyyy, sep='.') 09-28-2022 09/28/2022 09.28.2022 파이썬에서 print(sep=)를 사용하여 문자 및 문자열 사이에 특정한 문자열이나 기호 또는 공백을 넣을 수가 있다. 위의 예제 코드를 살펴보면 월, 일, 연도 사이에 sep=를 통해서 구분할 수 있는 기호가 출력되는 걸 확인할 수 있다.
2022. 9. 29.
[Python Example] print(), print(sep=), print(c1+c2+c3..) 차이점
print(), print(sep=), print(c1+c2+c3..) 차이점 포스트 난이도: HOO_Intern [Notice] 포스트 난이도에 대한 설명 안녕하세요, HOOAI의 Henry입니다. Bro들의 질문에 대한 내용을 우선적으로 포스팅이 되다 보니 각각의 포스트에 대한 난이도가 달라서 난이도에 대한 부분을 작성하면 좋겠다는 의견을 들었습니다 whoishoo.tistory.com # Python Example Codes c1='H' c2='O' c3='O' c4='A' c5='I' print(c1,c2,c3,c4,c5) print(c1,c2,c3,c4,c5,sep='') print(c1+c2+c3+c4+c5) H O O A I HOOAI HOOAI 파이썬(Python)에서 문자열(String)..
2022. 9. 29.
[R / RStudio] Error in file(file, ifelse(append, "a", "w")) : cannot open the connection
Error in file(file, ifelse(append, "a", "w")) : cannot open the connection 포스트 난이도: HOO_Junior [Notice] 포스트 난이도에 대한 설명 안녕하세요, HOOAI의 Henry입니다. Bro들의 질문에 대한 내용을 우선적으로 포스팅이 되다 보니 각각의 포스트에 대한 난이도가 달라서 난이도에 대한 부분을 작성하면 좋겠다는 의견을 들었습니다 whoishoo.tistory.com # Error in file(file, ifelse(append, "a", "w")) : cannot open the connection RStudio에서 작성한 코드를 실행해서 Plot을 출력하고자 할 때에는 발생하지 않는 문제이지만 산출된 값을 저장하려고 할 ..
2022. 9. 22.
[Python Q&A] Lab session for variables, operators, expressions, basic I/O, and string manipulation
Lab session for variables, operators, expressions, basic I/O, and string manipulation # Exercise 01 print('Sup World?') print(3 + 2 ) print('3 + 2') MyNumber = 3+2.0 MyName = 'Dusty' print(MyName, MyNumber) print('MyName', 'MyNumber') Sup World? 5 3 + 2 Dusty 5.0 MyName MyNumber What is the difference between print(3 + 2) and print('3 + 2') ? 위의 코드에서 3 + 2 를 출력하면 5가 나오지만 '3+2'를 출력하면 3+2가 산출된다. 3..
2022. 9. 20.