728x90
반응형

Python 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.


print("그냥 따라하기")
그냥 따라하기

print(10)
10


print(10, 20, 30)
10 20 30


print(10 20 30)
SyntaxError: invalid syntax. Perhaps you forgot a comma?

print(2.7)
2.7


print(2.5, 7.4, 90.56)
2.5 7.4 90.56


print(9, 5, 0.3)
9 5 0.3

pritn(" 정수를 출력" )
Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
    pritn(" 정수를 출력" )
NameError: name 'pritn' is not defined. Did you mean: 'print'?


print(" 우리 ")
 우리 


10
10


20
20


10, 20, 30
(10, 20, 30)


100 200 300
SyntaxError: invalid syntax


type(10)
<class 'int'>


type(2000)
<class 'int'>


type(50), type(70), type(100)
(<class 'int'>, <class 'int'>, <class 'int'>)


type(10), type(20)
(<class 'int'>, <class 'int'>)

type( 3, 5, 7)
Traceback (most recent call last):
  File "<pyshell#24>", line 1, in <module>
    type( 3, 5, 7)
TypeError: type.__new__() argument 1 must be str, not int

print(" 실수를 출력합니다. ")
 실수를 출력합니다. 
2.5
2.5
type(3.5)
<class 'float'>

print( 2.6, 3.2, 56.2)
2.6 3.2 56.2

print( 2, 54, 21)
2 54 21

 

print(5.6)
5.6


"문자열을 출력합니다"
'문자열을 출력합니다'

서울
Traceback (most recent call last):
  File "<pyshell#48>", line 1, in <module>
    서울
NameError: name '서울' is not defined


"서울"
'서울'

print(" \' \" 같아요 ")
 ' " 같아요 


print"서울", "부산", "광주")
SyntaxError: unmatched ')'

print("서울", "부산", "광주")
서울 부산 광주


"울산", 여수", "제주"_
SyntaxError: unterminated string literal (detected at line 1)


"울산", 여수", "제주"
SyntaxError: unterminated string literal (detected at line 1)


"울산", "여수", "제주"
('울산', '여수', '제주')


type("대한민국")
<class 'str'>


type("gkasdf")
<class 'str'>


type('korea')
<class 'str'>


type('대한')
<class 'str'>

반응형

+ Recent posts