Skip to content
Snippets Groups Projects
Commit cd864de6 authored by rejenver's avatar rejenver
Browse files

Add new file

parent e11af671
Branches
No related tags found
No related merge requests found
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> a = ["aaa", "bbb", "ccc"]
>>> a
['aaa', 'bbb', 'ccc']
>>> a[1]
'bbb'
>>> b = [123,456,"789"]
>>> type b[1]
SyntaxError: invalid syntax
>>> type b
SyntaxError: invalid syntax
>>> type(b[1])
<class 'int'>
>>> type(b[2])
<class 'str'>
>>> b[0:1]
[123]
>>> b[0:2]
[123, 456]
>>> b[0:3]
[123, 456, '789']
>>> b[1:2]
[456]
>>> len(a)
3
>>> len(b)
3
>>> s="Dohun Na"
>>> s[2] = D
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
s[2] = D
NameError: name 'D' is not defined
>>> s[2] = "D"
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
s[2] = "D"
TypeError: 'str' object does not support item assignment
>>> s = "Kim"
>>> t = (1,2,3)
>>> t = (3,4,5)
>>> t
(3, 4, 5)
>>> c = (1,)
>>> type(c)
<class 'tuple'>
>>> c = 1,
>>> type(c)
<class 'tuple'>
>>> c
(1,)
>>> d = (1)
>>> type(d)
<class 'int'>
>>> d = 1 + 3 & 0x01
>>> type(d)
<class 'int'>
>>> d
0
>>> a = -1
>>> bin(a)
'-0b1'
>>> a = -4
>>> bin(a)
'-0b100'
>>> b = 0b00110011
>>> a & b
48
>>> bin(a & b)
'0b110000'
>>> b
51
>>> (a * -1) = (a + 1)
SyntaxError: can't assign to operator
>>> (a * -1) = (a + -1)
SyntaxError: can't assign to operator
>>> a = 1,2,3
>>> a
(1, 2, 3)
>>> one, two, three = a
>>> one
1
>>> tow
Traceback (most recent call last):
File "<pyshell#45>", line 1, in <module>
tow
NameError: name 'tow' is not defined
>>> two
2
>>> three
3
>>> a
(1, 2, 3)
>>> 1
1
>>> a="1234"
>>> len(a)
4
>>> a
'1234'
>>> len = "1234"
>>> len(len)
Traceback (most recent call last):
File "<pyshell#54>", line 1, in <module>
len(len)
TypeError: 'str' object is not callable
>>>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment