-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice6.py
More file actions
59 lines (59 loc) · 1.55 KB
/
practice6.py
File metadata and controls
59 lines (59 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# 문자열 사용하기
hello = 'Hello, world!'
print(hello)
hello1 = '안녕하세요'
print(hello1)
hello2 = "Hello, Program"
print(hello2)
hello3 = '''Hello, Python!'''
print(hello3)
python = """Python Programming"""
print(python)
# 여러 줄로 된 문자열(multiline string) 사용하기
hello = '''Hello, world!
안녕하세요.
Python입니다.'''
print(hello)
# 문자열 안에 작은따옴표나 큰따옴표 포함하기
s = 'He said "Python is easy".'
s1 = "Python isn't difficult."
s2 = """"Hello", Python"""
s3 = """Hello, 'Python'"""
print(s, s1, s2, s3, sep='\n')
s = 'Python isn\'t difficult.'
s1 = 'Hello, \'Python\''
print(s, s1, sep='\n')
# 연습문제: 여러 줄로 된 문자열 사용하기
s = '''Python is a programming language that lets you work quickly
and
integrate systems more effectively.'''
print(s)
# 심사문제: 여러 줄로 된 문자열 사용하기
# s = '''\'Python\' is a "programming language"
# that lets you work quickly
# and
# integrate systems more effectively.'''
# 다른 방법
s = """'Python' is a "programming language"
that lets you work quickly
and
integrate systems more effectively."""
print(s)
# 리스트 만들기
a = [38, 21, 53, 62, 19]
person = ['james', 17, 175.3, True]
print(a)
print(person)
# range를 사용하여 리스트 만들기
a = list(range(10))
b = list(range(5, 12))
c = list(range(-4, 10, 2))
d = list(range(10, 0, -1))
print(a, b, c, d, sep='\n')
# range로 리스트 만들기
a = list(range(5, -10, -2))
print(a)
# range로 튜플 만들기
a = int(input())
b = tuple(range(-10, 10, a))
print(b)