코딩/파이썬

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

이비유스 2021. 5. 21. 13:41
반응형

데이터캠프 파이썬 공부 2일차..

여기 티스토리 말고

네이버 블로그에 전에 소개한 적이 있던

solo learn으로 파이썬 공부하는 것보다

데이터캠프로 공부하는 게 더 재밌는거 같다.

PC로 4분활 화면으로 봐서 그런가 ㅎㅎ

아무튼 2일차 시작

 

Variable Assignment

In Python, a variable allows you to refer to a value with a name. To create a variable use =, like this example:

x = 5

You can now use the name of this variable, x, instead of the actual value, 5.

Remember, = in Python means assignment, it doesn't test equality!

 

Python에서 변수를 사용하면 이름이 있는 값을 참조할 수 있습니다.

변수를 생성하려면 다음 예와 같이 =를 사용하십시오.

x = 5
이제 실제 값인 5 대신 이 변수 x의 이름을 사용할 수 있습니다.
Python에서 =는 할당을 의미하지만 동일성을 테스트하지 않습니다!

 

역시 파파고로 번역.

변수에 대한 설명과 문제였다.

크게 어렵지 않다

= 는 변수값을 정해주는 거라 생각하면 될거같다.

그냥 코알못이니 그렇게 이해하고 넘어갔음 ㅠ

 

Calculations with variables

Remember how you calculated the money you ended up with after 7 years of investing $100?

You did something like this:

100 * 1.1 ** 7

Instead of calculating with the actual values, you can use variables instead.

The savings variable you've created in the previous exercise represents the $100 you started with.

It's up to you to create a new variable to represent 1.1 and then redo the calculations!

 

당신이 7년 동안 100달러를 투자하고 난 후에 당신이 얻게 된 돈을 어떻게 계산했는지 기억하십니까?
이런 일을 하셨잖아요.
100 * 1.1 ** 7
실제 값으로 계산하는 대신 변수를 사용할 수 있습니다.
이전 연습에서 생성한 절약 변수는 시작했던 100달러를 나타냅니다.
1.1을 나타내는 새 변수를 생성한 다음 계산을 다시 수행하는 것은 사용자의 책임입니다!

종전에는 100달러에 1.1의 7제곱을 곱해서 계산을 했는데

이번에는 100달러와 1.1에 각각 변수를 입력하고 변수를 곱해서 계산하는 문제였다.

Other variable types

In the previous exercise, you worked with two Python data types:

  • int, or integer: a number without a fractional part. savings, with the value 100, is an example of an integer.
  • float, or floating point: a number that has both an integer and fractional part, separated by a point. growth_multiplier, with the value 1.1, is an example of a float.

Next to numerical data types, there are two other very common data types:

  • str, or string: a type to represent text. You can use single or double quotes to build a string.
  • bool, or boolean: a type to represent logical values. Can only be True or False (the capitalization is important!).

이전 연습에서는 두 가지 Python 데이터 유형을 사용하여 작업했습니다.

int 또는 정수: 부분 부분이 없는 숫자입니다. 절약은 값이 100인 정수의 예입니다.
부동 소수점 또는 부동 소수점: 정수 부분과 분수 부분을 모두 가진 숫자로 구분합니다. growth_competier, 1.1 값은 부동의 예이다.
수치 데이터 유형 옆에는 두 가지 매우 일반적인 데이터 유형이 있습니다.

str 또는 문자열: 텍스트를 나타내는 형식입니다. 작은 따옴표나 큰 따옴표를 사용하여 문자열을 작성할 수 있습니다.
boole 또는 boole: 논리 값을 나타내는 유형입니다. 참 또는 거짓만 사용할 수 있습니다. 대문자 표시가 중요합니다!

어려움없이 이번 문제는 성공!

Guess the type

To find out the type of a value or a variable that refers to that value, you can use the type() function. Suppose you've defined a variable a, but you forgot the type of this variable. To determine the type of a, simply execute:

type(a)

We already went ahead and created three variables: a, b and c. You can use the IPython shell to discover their type. Which of the following options is correct?

 

해당 값을 참조하는 값 또는 변수의 유형을 확인하려면 type() 함수를 사용할 수 있습니다. 변수 a를 정의했지만 이 변수의 유형을 잊어버렸다고 가정합니다. a의 유형을 확인하려면 다음을 실행하십시오.

활자(a)를 치다

우리는 이미 세 가지 변수를 만들었습니다: a, b, c. IPython 셸을 사용하여 해당 유형을 검색할 수 있습니다. 다음 중 올바른 옵션은 무엇입니까?

 

 

이 문제는 객관식이지만 직접 옆에 idle에 대입해봐야지

답을 알 수 있는 문제다

대입만 해보면 쉬움.

 

2일차도 이렇게 끝났다.

아직까진 막힘없이 술술 진행하고있다.

이런게 모여서 어떻게 코딩을하고

프로그램이 만들어지는지 궁금하다 ㅎㅎ

반응형