Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 2.6.5
>>> a=[1,2,3]
>>> b=a
>>> a[1]
2
>>> a[1]=4
>>> b
[1, 4, 3]
>>> 1
1
>>> a
[1, 4, 3]
>>> a=[1,2,3]
>>> b=a[:]
>>> a[1,4,3]
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
a[1,4,3]
TypeError: list indices must be integers, not tuple
>>> from copy import copy
>>> b=copy(a)
>>> b is a
False
>>>
>>> money=1
>>> if money:
print "taxi"
else:
print "on foot"
taxi
>>> if a>3:
print "Hello"
else:
print "nop!"
a=3
Hello
>>> money=1
>>> x=3
>>> y=2
>>> x>y
True
>>> x<y
False
>>> print "Using : %p\n",0x1032
Using : %p
4146
>>> money=2000
>>> if money >=3000:
print "taxi"
else:
print "on foot"
on foot
>>> 1 in [1,2,3]
True
>>> 1 not in [1,2,3]
False
>>> pocket=['paper','handphone','money']
>>> if
SyntaxError: invalid syntax
>>> if
SyntaxError: invalid syntax
>>> if
SyntaxError: invalid syntax
'
>>> if 'money' in 'pocket':
print "taxi"
else:
print "on foot"
on foot
>>>
>>> pocket=['paper','hadndphone']
>>> watch=1
>>> if 'money' in pocket:
print "taxi"
elif watch:
print "taxi"
else:
print "on foot"
taxi
>>>
>>> pocket=['paper','money','handphone']
>>> if 'money' in pocket:
pass
else:
print "ttttt"
>>> if 'money' in pocket:pass
else: print "ttttt"
>>> treeHit=0
>>> while treeHit<10:
treeHit=treeHit+1
print "나무를 %d번 찍엇음." % treeHit
if treeHit==10:
print"나무가넘어감"
나무를 1번 찍엇음.
나무를 2번 찍엇음.
나무를 3번 찍엇음.
나무를 4번 찍엇음.
나무를 5번 찍엇음.
나무를 6번 찍엇음.
나무를 7번 찍엇음.
나무를 8번 찍엇음.
나무를 9번 찍엇음.
나무를 10번 찍엇음.
나무가넘어감
>>> 나무를 2번 찍엇음.
SyntaxError: invalid syntax
>>> while 1:
print "ctrl+c"
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
Traceback (most recent call last):
File "<pyshell#83>", line 2, in <module>
print "ctrl+c"
KeyboardInterrupt
>>> prompt ="""
1.Add
2.Del
3.List
4.Quit
Enter number: """
>>>
>>> number=0
>>> while number !=4:
print prompt
number = int(raw_input())
1.Add
2.Del
3.List
4.Quit
Enter number:
'
Traceback (most recent call last):
File "<pyshell#96>", line 3, in <module>
number = int(raw_input())
ValueError: invalid literal for int() with base 10: "'"
>>> coffee =10
>>> money =300
>>> while money:
print "give coffee"
coffee=coffee-1
print "남은양 : %d" % coffee
if not coffee:
print "don't have coffee"
break
give coffee
남은양 : 9
give coffee
남은양 : 8
give coffee
남은양 : 7
give coffee
남은양 : 6
give coffee
남은양 : 5
give coffee
남은양 : 4
give coffee
남은양 : 3
give coffee
남은양 : 2
give coffee
남은양 : 1
give coffee
남은양 : 0
don't have coffee
>>> don't have coffee
SyntaxError: EOL while scanning string literal
>>> a=0
>>> while a<10:
a=a+1
if a%2==0:continue
print a
1
3
5
7
9
>>> test_list=['one','two','three']
>>> for i in test_list:
print i
one
two
three
>>> mark=[90,25,67,45,80]
>>> number=0
>>> for mar in mark:Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 2.6.5
>>> a=[1,2,3]
>>> b=a
>>> a[1]
2
>>> a[1]=4
>>> b
[1, 4, 3]
>>> 1
1
>>> a
[1, 4, 3]
>>> a=[1,2,3]
>>> b=a[:]
>>> a[1,4,3]
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
a[1,4,3]
TypeError: list indices must be integers, not tuple
>>> from copy import copy
>>> b=copy(a)
>>> b is a
False
>>>
>>> money=1
>>> if money:
print "taxi"
else:
print "on foot"
taxi
>>> if a>3:
print "Hello"
else:
print "nop!"
a=3
Hello
>>> money=1
>>> x=3
>>> y=2
>>> x>y
True
>>> x<y
False
>>> print "Using : %p\n",0x1032
Using : %p
4146
>>> money=2000
>>> if money >=3000:
print "taxi"
else:
print "on foot"
on foot
>>> 1 in [1,2,3]
True
>>> 1 not in [1,2,3]
False
>>> pocket=['paper','handphone','money']
>>> if 'money' in 'pocket':
print "taxi"
else:
print "on foot"
on foot
>>>
>>> pocket=['paper','hadndphone']
>>> watch=1
>>> if 'money' in pocket:
print "taxi"
elif watch:
print "taxi"
else:
print "on foot"
taxi
>>>
>>> pocket=['paper','money','handphone']
>>> if 'money' in pocket:
pass
else:
print "ttttt"
>>> if 'money' in pocket:pass
else: print "ttttt"
>>> treeHit=0
>>> while treeHit<10:
treeHit=treeHit+1
print "나무를 %d번 찍엇음." % treeHit
if treeHit==10:
print"나무가넘어감"
나무를 1번 찍엇음.
나무를 2번 찍엇음.
나무를 3번 찍엇음.
나무를 4번 찍엇음.
나무를 5번 찍엇음.
나무를 6번 찍엇음.
나무를 7번 찍엇음.
나무를 8번 찍엇음.
나무를 9번 찍엇음.
나무를 10번 찍엇음.
나무가넘어감
>>> 나무를 2번 찍엇음.
SyntaxError: invalid syntax
>>> while 1:
print "ctrl+c"
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
ctrl+c
Traceback (most recent call last):
File "<pyshell#83>", line 2, in <module>
print "ctrl+c"
KeyboardInterrupt
>>> prompt ="""
1.Add
2.Del
3.List
4.Quit
Enter number: """
>>>
>>> number=0
>>> while number !=4:
print prompt
number = int(raw_input())
1.Add
2.Del
3.List
4.Quit
Enter number:
'
Traceback (most recent call last):
File "<pyshell#96>", line 3, in <module>
number = int(raw_input())
ValueError: invalid literal for int() with base 10: "'"
>>> coffee =10
>>> money =300
>>> while money:
print "give coffee"
coffee=coffee-1
print "남은양 : %d" % coffee
if not coffee:
print "don't have coffee"
break
give coffee
남은양 : 9
give coffee
남은양 : 8
give coffee
남은양 : 7
give coffee
남은양 : 6
give coffee
남은양 : 5
give coffee
남은양 : 4
give coffee
남은양 : 3
give coffee
남은양 : 2
give coffee
남은양 : 1
give coffee
남은양 : 0
don't have coffee
>>> don't have coffee
SyntaxError: EOL while scanning string literal
>>> a=0
>>> while a<10:
a=a+1
if a%2==0:continue
print a
1
3
5
7
9
>>> test_list=['one','two','three']
>>> for i in test_list:
print i
one
two
three
>>> mark=[90,25,67,45,80]
>>> number=0
>>> for mar in mark:
number=number+1
if mar >=60:
print "%d번 학생은 합격" %number
else:
print "%d번 학생은 불합격" %number
1번 학생은 합격
2번 학생은 불합격
3번 학생은 합격
4번 학생은 불합격
5번 학생은 합격
number=number+1
if mar >=60:
print "%d번 학생은 합격" %number
else:
print "%d번 학생은 불합격" %number
1번 학생은 합격
2번 학생은 불합격
3번 학생은 합격
4번 학생은 불합격
5번 학생은 합격
자판기.py
+)미숙해서 그런건지 짱구가 안굴러가서 그런건지 ㅡㅡ ;아직은 진전이없음