Skip to content

Commit

Permalink
공부한거 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
youngyoungsw2020 committed Feb 14, 2021
1 parent bee2eef commit 4ec06f8
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 2 deletions.
4 changes: 3 additions & 1 deletion basic/1_variable.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

'''
문단주석
'''
Expand All @@ -13,7 +15,7 @@
print(type(stock_earning))

# str 은 문자
stock_name = "문자입니다."
stock_name = "aaa"
print("stock_name : %s" % stock_name)
print(type(stock_name))

Expand Down
5 changes: 4 additions & 1 deletion basic/2_math.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# -*- coding: utf-8 -*-

'''
덧셈, 뺄셈, 곱셈, 나눗셈
'''

#int 더하기
#기본 값 세팅
stock_price1 = 1000
stock_price2 = 2000

#int 더하기
stock_price_total = stock_price1 + stock_price2
print("%s" % stock_price_total)

Expand Down
7 changes: 7 additions & 0 deletions basic/3_0_conditional_statements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cnt=0

if cnt == 30:
print("number 1")

print("number 2")

8 changes: 8 additions & 0 deletions basic/3_1_conditional_statements for.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
count = 0
for i in range(0, 10):
count = count + 1

print(count)

for i, value in enumerate(['kium', 'samsung', 'kakao']):
print("%s is numeric, %s is value" % (i,value))
9 changes: 9 additions & 0 deletions basic/3_2_conditional_statements_while.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

cnt = 0
repeat_boolean = True
while repeat_boolean:
print("%s while statement is running" % cnt)
cnt = cnt+1
if cnt == 30:
repeat_boolean = False
print("the end")
18 changes: 18 additions & 0 deletions basic/4_1_tuple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# like a javascript array
# tuple is not able to add or update
a_tuple = {"kiumn","daesin", "kakao"}
print(a_tuple)

a_len = len(a_tuple)
print(a_len)

a_type = type(a_tuple)
print(a_type)

for value in a_tuple:
print(value)

for index, value in enumerate(a_tuple):
print("%s is index, %s is value" % (index, value))

14 changes: 14 additions & 0 deletions basic/4_2_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
a_list = ["list1", "list2", "list3"]

print(a_list)

for index,value in enumerate(a_list):
print("%s, %s" %(index,value))


a_list = ["a_list1", "a_list2", "a_list3"]
b_list = ["b_list1", "b_list2"]

a_list.append(b_list)

print(a_list)
36 changes: 36 additions & 0 deletions basic/4_3_dictionary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# like a map of JAVA
a_dict = {"key 1" : "value 1"
,"key 2" : "value 2"
,"key 3" : "value 3"}

print(type(a_dict))
print(a_dict)
print(a_dict['key 1'])

for key in a_dict:
print('%s is key. %s is value.' % (key, a_dict[key]))

a_dict.update({"key 4" : "value 4", "key 5" : "value 5"})
print(a_dict)

for value in a_dict.keys():
print("value : %s" % value)
if value == "key 1":
print("222222222222222222222")
elif value == "key 2":
print("33333333333333333333")
else:
print("44444444444444444444")


#like a map inner map of JAVA
b_dict = {"bkey 1" :
{"bkey 11" : "bvalue11"
,"bkey 12" : "bvalue122"
}
}

print(b_dict)
print(b_dict['bkey 1']['bkey 12'])


0 comments on commit 4ec06f8

Please sign in to comment.