코딩/파이썬

[데이터캠프] 문과생 비전공자 파이썬 공부하기 Day 3

이비유스 2021. 6. 17. 11:38
반응형

연달아 금방 끝냈는데

3일차 포스팅이 너무 늦어버렸다.

간략히 빨리 진행하도록 해야지~

Operations with other types
Hugo mentioned that different types behave differently in Python.
When you sum two strings, for example, you'll get different behavior than

when you sum two integers or two booleans.
In the script some variables with different types have already been created. It's up to you to use them.

 

다른 유형을 사용한 작업
휴고는 파이썬에서는 다른 타입이 다르게 행동한다고 언급했다.
예를 들어, 두 개의 문자열을 합하면 두 개의 정수 또는 두 개의 부울을 합할 때와 다른 동작이 나타납니다.
스크립트에서 유형이 다른 일부 변수가 이미 생성되었습니다. 그것들을 사용하는 것은 너에게 달려있다.

Calculate the product of savings and growth_multiplier. Store the result in year1.
What do you think the resulting type will be? Find out by printing out the type of year1.
Calculate the sum of desc and desc and store the result in a new variable doubledesc.
Print out doubledesc. Did you expect this?

 

절약과 성장의 곱셈을 계산하십시오. 결과를 year1에 저장한다.
어떤 결과가 나올 것 같습니까? year1의 유형을 출력하여 확인합니다.
설명과 설명의 합계를 계산하여 결과를 새 변수 이중 데스크에 저장합니다.
이중 데스크를 인쇄합니다. 이럴 줄 알았어?

 

year1의 유형을 출력하는데 print 명령어를 빼놓고 입력함 ㅠㅠ

다시 제대로 입력해서 통과~~~

 

  • Hit Run Code to run the code. Try to understand the error message.
  • Fix the code such that the printout runs without errors; use the function str() to convert the variables to strings.
  • Convert the variable pi_string to a float and store this float as a new variable, pi_float.

Run Code를 눌러 코드를 실행합니다. 오류 메시지를 이해하려고 합니다.
출력물이 오류 없이 실행되도록 코드를 수정하고 함수 str()를 사용하여 변수를 문자열로 변환합니다.
변수 pi_string을 float로 변환하고 이 float을 새 변수 pi_float로 저장합니다.

크게 어렵지 않게 통과 할 수 있을거 같다.

Can Python handle everything?
Now that you know something more about combining different sources of information, have a look at the four Python expressions below. Which one of these will throw an error? You can always copy and paste this code in the IPython Shell to find out!

 

파이썬이 모든 걸 처리할 수 있을까?
이제 서로 다른 정보 소스를 결합하는 방법에 대해 좀 더 자세히 알아보셨으니 아래 네 가지 파이썬 식을 살펴보십시오. 다음 중 어느 것이 오류를 발생시키나요? 언제든지 이 코드를 복사하여 IPython Shell에 붙여 넣으면 알 수 있습니다!

데이터캠프 무료인줄 알았는데 기초강의만 무료였...ㅠㅠㅠ

아아 다시 다른 강의를 찾아보러가야겠네요 ㅠ

반응형