GentBG - why bother to burn STEEM?

Image
by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/gentbg-why-bother-to-burn-steem GentBG - a new experiment to burn STEEM Hello, this is @joviansummer(witness: @jswit). I'd like to briefly explain why I bothered to start @gentbg experiment. Unlike bitcoin, STEEM has no supply limit. As long as STEEM exists, newly minted STEEM will be added to total supply. If we can't maintain corresponding demand or reduce supply, downward pressure on STEEM price can be a big challenge. @gentbg project is an experiment to reduce STEEM supply by burning. @gentbg will burn liquid author reward and delegate SP reward to @jsup to get amplified upvotes. The main purpose is to create a perpetual STEEM burning loop. I added a bit of fun factor via AI-generated images, to incentivize giving upvotes to @gentbg's posts. If you have some spare voting power, you can contribute to burning STEEM by giving upvotes to @gentbg's posts. Initial run of this experiment wil...

파이썬의 딕셔너리(dict)에서 특정 키(key)가 존재하는지 확인하기

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/dict-key


key:value 형태로 구성되는 딕셔너리(dict) 형식의 변수에서 특정한 키(key)가 포함되어 있는지 확인하는 방법입니다.

일단 아래와 같이 x_dict라는 변수를 생각해 봅니다.

x_dict = { 'abc':100, 'def':50, 'xyz':99 }

x_dict에 "def"라는 키가 있는지 확인하려면 간단하게 if 조건문으로 가능합니다.

if 'def' in x_dict:
  print('x_dict에 키 def가 존재합니다.')
else:
  print('x_dict에 키 def가 존재하지 않습니다.')

딕셔너리의 value 항목을 리스트(list) 또는 딕셔너리로 구성하려면 실제 값을 할당하기 전에 초기화를 해 주어야 하는데, 이와 관련하여 간단한 예시를 메모해 둡니다.

target_list = { 'abc':[1,2,3] }
target_key = 'def'

if target_key in target_list:
  # value에 10을 추가, 리스트 형태이므로 append() 사용
  target_list[target_key].append(10)
else:
  print("target_list에 ", target_key, "키가 없습니다."
  # value를 리스트 형식으로 선언한 후에 value에 10을 추가
  target_list[target_key] = []
  target_list[target_key].append(10)

print(target_list)

{'abc': [1, 2, 3], 'def': [10]}

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle code update - you don't have to write post everyday

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기