Skip to content

Commit 686d3ba

Browse files
committed
0909 실습
0909 실습
1 parent 4ab191b commit 686d3ba

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed

Test0909/Test0909.sln

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.40629.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Test0909", "Test0909\Test0909.pyproj", "{C11781EF-6588-4D9D-97AD-CDA891C989D2}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{C11781EF-6588-4D9D-97AD-CDA891C989D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C11781EF-6588-4D9D-97AD-CDA891C989D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal

Test0909/Test0909.v12.suo

18 KB
Binary file not shown.

Test0909/Test0909/Test0909.py

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
dic1 = {}
2+
dic2 = dict()
3+
dic = {'name':'pey', 'phone':'01051035773'}
4+
print(dic['name']) #pey
5+
dic['birth'] = '1212'
6+
print(dic) #랜덤출력
7+
del dic['name']
8+
print(dic.keys()) #key값
9+
print(dic.values()) #value값
10+
11+
b = list(dic.keys()) #리스트로 반환
12+
print(b)
13+
14+
b = dic.items() #튜플로써 묶여진 형태의 값을 반환
15+
print(b)
16+
17+
#dic.clear() #지우기
18+
print(dic.get('name')) #None
19+
print(dic.get('birth')) #1212
20+
dic.get('name','sm') #해당 key가 없으면 default로 sm
21+
'name' in dic #key가 있는지 조사
22+
23+
#영화 별점주기 실습
24+
#dic 안에 dic
25+
movies = {'홍길동':{'베테랑':5.0,'암살':4.5},'고길동':{'베테랑':3.5,'암살':3.0}}
26+
print(movies['홍길동']) #홍길동이 준 점수들
27+
#print(movies.get('홍길동'))
28+
print(movies['홍길동']['암살']) #암살 점수만
29+
#print(movies.get('홍길동').get('암살'))
30+
31+
#대소문자 구분
32+
# == != < > <= >= and or not 조건문에 응용
33+
answer = input("Would you like express shipping? : ")
34+
answer = answer.lower()
35+
if answer == "yes" :
36+
print("That will be an extra $10")
37+
38+
pocket = ['paper', 'money', 'cellphone']
39+
if 'card' in pocket: pass # pass 사용법. 한 줄일 때 사용법
40+
else: print("카드를 꺼내라")
41+
42+
a = [(1,2), (3,4), (5,6)]
43+
for (first, last) in a : #a의 튜플 하나씩 가져오는데 first, last로 이름을 붙이고
44+
print(first + last) #first+last 해서 출력
45+
46+
for steps in range(1,10,2) :
47+
print(steps) #1,3,5,7,9
48+
49+
#구구단 출력
50+
#print하면 기본적으로 줄바꿈이 되는데 end=" " 옵션을 주면
51+
#줄바꿈 하지않고 " " 공백 한 칸 출력
52+
for i in range(2,10):
53+
for j in range(1,10):
54+
print('{0:d}*{1:d}={2:d}'.format(i,j,i*j), end=" ")
55+
print('')
56+
57+
#turtle 라이브러리 불러오기
58+
import turtle
59+
#for steps in range(4): #4번 움직여라
60+
# turtle.forward(100)
61+
# turtle.right(90)
62+
63+
nSides = 7 # 7각형 안에 7각형
64+
for steps in ['red','blue','green','black','yellow','cyan','purple']:
65+
turtle.color(steps)
66+
turtle.forward(100)
67+
turtle.right(360/nSides)
68+
for moresteps in range(nSides):
69+
turtle.forward(50)
70+
turtle.right(360/nSides)
71+
input("")
72+
73+
#여러 줄에 걸쳐있는 것을 하나의 문자열로 선언
74+
prompt = """
75+
1. Add
76+
2. Del
77+
3. List
78+
4. Quit
79+
80+
Enter number: """
81+
82+
number = 0
83+
while number != 4:
84+
print(prompt, end="")
85+
number = int(input())
86+
# 반복문 나갈 때 break / 조건으로 분기하고 싶으면 continue

Test0909/Test0909/Test0909.pyproj

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<SchemaVersion>2.0</SchemaVersion>
6+
<ProjectGuid>c11781ef-6588-4d9d-97ad-cda891c989d2</ProjectGuid>
7+
<ProjectHome>.</ProjectHome>
8+
<StartupFile>Test0909.py</StartupFile>
9+
<SearchPath>
10+
</SearchPath>
11+
<WorkingDirectory>.</WorkingDirectory>
12+
<OutputPath>.</OutputPath>
13+
<Name>Test0909</Name>
14+
<RootNamespace>Test0909</RootNamespace>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
21+
<DebugSymbols>true</DebugSymbols>
22+
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
23+
</PropertyGroup>
24+
<ItemGroup>
25+
<Compile Include="Test0909.py" />
26+
</ItemGroup>
27+
<PropertyGroup>
28+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
29+
<PtvsTargetsFile>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets</PtvsTargetsFile>
30+
</PropertyGroup>
31+
<Import Condition="Exists($(PtvsTargetsFile))" Project="$(PtvsTargetsFile)" />
32+
<Import Condition="!Exists($(PtvsTargetsFile))" Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
33+
<!-- Uncomment the CoreCompile target to enable the Build command in
34+
Visual Studio and specify your pre- and post-build commands in
35+
the BeforeBuild and AfterBuild targets below. -->
36+
<!--<Target Name="CoreCompile" />-->
37+
<Target Name="BeforeBuild">
38+
</Target>
39+
<Target Name="AfterBuild">
40+
</Target>
41+
</Project>

0 commit comments

Comments
 (0)