[파이썬300제] 151~180 정리

·2023년 10월 11일

Python 300

목록 보기
2/5
post-thumbnail

1. isupper() method

variable.isupper() 
  • isupper(variable) : 이렇게 사용X

2. method vs function

  • method → associated to an object!(dependent)
  • function → called by its name(independent)

3. range() function

  • range(stop) : 0 ~ stop-1 까지 (start default: 0)
  • range(start, stop) : start ~ stop-1 까지
  • range(start, stop, step) : start ~ stop-1까지 step씩 (step default: 1)

4. abs() function

  • returns the absolute value of the specified number
x = abs(-7.25)
print(abs)

>>> 7.25

5. append() method

list.append(element) 
  • 리스트에 사용가능한 method!
  • 괄호 안에 추가할 요소를 넣어준다
a = "good "
b = "morning"
c = []

c.append(a + b)

print(c)
>>>['good morning']
profile
사랑을담아봄

0개의 댓글