-
Notifications
You must be signed in to change notification settings - Fork 56
/
autodev_tutorial.py
82 lines (51 loc) · 2.52 KB
/
autodev_tutorial.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""
** ** *******
**** /** /**////**
**//** ** ** ****** ****** /** /** ***** ** **
** //** /** /**///**/ **////**/** /** **///**/** /**
**********/** /** /** /** /**/** /**/*******//** /**
/**//////**/** /** /** /** /**/** ** /**//// //****
/** /**//****** //** //****** /******* //****** //**
// // ////// // ////// /////// ////// //
Welcome to AutoDev! This is a 2 minute tutorial.
You can click the gray buttons, starting with "Highlight the function" to follow along.
"""
# region —————————————————————————— Part 1: Ask a question about code [Cmd+L] ——————————————————————————
"""Step 1: Highlight the function below"""
def mysterious_function(x):
for i in range(len(x)):
for j in range(len(x) - 1):
if x[j] > x[j + 1]:
x[j], x[j + 1] = x[j + 1], x[j]
return x
"""Step 2: Use the keyboard shortcut [Cmd+L] to
select the code and toggle the AutoDev input box"""
"""Step 3: Ask a question and press Enter"""
# endregion
# region ————————————————————————————————— Part 2: Edit code [Cmd+I] —————————————————————————————————
"""Step 1: Highlight this code"""
def mysterious_function(x):
n = len(x)
for i in range(n):
swapped = False
for j in range(0, n - i - 1):
if x[j] > x[j + 1]:
x[j], x[j + 1] = x[j + 1], x[j]
swapped = True
if swapped == False:
break
return x
"""Step 2: Use the keyboard shortcut [Cmd+I] to edit"""
"""Step 3: Type "<your edit request>" and press Enter"""
"""Step 4: Use keyboard shortcuts to
accept [Cmd+Shift+Enter] or reject [Cmd+Shift+Backspace] the edit"""
# endregion
# region ———————————————————————————— Part 3: Debug automatically [Cmd+Shift+R] ————————————————————————————
"""Step 1: Run this Python file (it should error!)"""
def print_sum(list_to_print):
print(sum(list_to_print))
"""Step 2: Use the keyboard shortcut [Cmd+Shift+R]
to automatically debug the error"""
print_sum(["a", "b", "c"])
# endregion
# Ready to learn more? Check out the Continue documentation: https://vscode.unitmesh.cc/