Dataset Viewer
Auto-converted to Parquet Duplicate
labNo
float64
1
10
taskNo
float64
0
4
questioner
stringclasses
2 values
question
stringlengths
9
201
code
stringlengths
18
30.3k
startLine
float64
0
192
endLine
float64
0
196
questionType
stringclasses
4 values
answer
stringlengths
2
905
src
stringclasses
3 values
code_processed
stringlengths
12
28.3k
id
stringlengths
2
5
raw_code
stringlengths
20
30.3k
raw_comment
stringlengths
10
242
comment
stringlengths
9
207
q_code
stringlengths
66
30.3k
3
3
TA
In task4, can you explain how do you check blanks are window or corner?
from cs1robots import * def turn_left(): global dx, dy dx, dy = -dy, dx my_robot.turn_left() def turn_right(): for i in range(3): turn_left() def move_further() : global x, y x += dx y += dy my_robot.move() def go_back() : for i in range(2) : turn_left() move_...
38
53
code_explain
Okay, so I mainly try to go right if it is possible. And then there are two cases: 1) window 2) corner if it is a window then when I turn right and go forward, left and right of the robot must still be empty. If it is a corner, the right of the robot must not be empty. The variable counter keeps this information for me...
cs1qa
null
null
null
null
null
Question: In task4, can you explain how do you check blanks are window or corner? Code: from cs1robots import * def turn_left(): global dx, dy dx, dy = -dy, dx my_robot.turn_left() def turn_right(): for i in range(3): turn_left() def move_further() : global x, y x += dx y += dy...
4
1
TA
When does the is_triangle() function return True in Task2?
def is_triangle(a, b, c): if a+b>c and b+c>a and c+a>b: return True return False a = float(input('Side a: ')) b = float(input('Side b: ')) c = float(input('Side c: ')) # all because this is dynamic language. # type conversion by float() was inevitable... totally bonkers. if is_triangle(a, b, c): print("YES")...
0
3
variable
Returns True if the trigonometric inequalities are in turn for all sides.
cs1qa
null
null
null
null
null
Question: When does the is_triangle() function return True in Task2? Code: def is_triangle(a, b, c): if a+b>c and b+c>a and c+a>b: return True return False a = float(input('Side a: ')) b = float(input('Side b: ')) c = float(input('Side c: ')) # all because this is dynamic language. # type conversion by floa...
4
2
TA
Task 3: Is the parameter of the sine function degree or radian?
import math sin = math.sin pi = math.pi a= int(input('How many steps? ')) for i in range(a): x = float(i) / float(a-1) * 2 * pi print (sin(x))
6
7
variable
Task 3: The argument of the sine function is converted to radians by multiplying by 2*pi.
cs1qa
null
null
null
null
null
Question: Task 3: Is the parameter of the sine function degree or radian? Code: import math sin = math.sin pi = math.pi a= int(input('How many steps? ')) for i in range(a): x = float(i) / float(a-1) * 2 * pi print (sin(x))
5
0
TA
Why should I use global balance in task1?
balance = 0 def deposit(money) : # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance ################# ### implement ### ################# # Do something on here ! global balance balance = ...
12
12
reasoning
I used it because I had to change the value of the balance (because I have to use it, not just read it)!
cs1qa
null
null
null
null
null
Question: Why should I use global balance in task1? Code: balance = 0 def deposit(money) : # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance ################# ### implement ### ################# ...
3
0
TA
What is the orient function in task1?
from cs1robots import * create_world(avenues = 4, streets = 7) hubo=Robot(orientation = 'W', avenue = 3, street = 5) hubo.set_trace('blue') def orient(): while hubo.facing_north() == False: hubo.turn_left() hubo.turn_left() def move(): while hubo.front_is_clear(): hubo.move() hubo...
5
8
variable
I have set up the code to make the direction look east.
cs1qa
null
null
null
null
null
Question: What is the orient function in task1? Code: from cs1robots import * create_world(avenues = 4, streets = 7) hubo=Robot(orientation = 'W', avenue = 3, street = 5) hubo.set_trace('blue') def orient(): while hubo.facing_north() == False: hubo.turn_left() hubo.turn_left() def move(): ...
1
1
TA
OK~ Please explain why the input value is float and int like float(a) in task2 and int(k) in task3~
def is_triangle(a, b, c): if float(a)+float(b)>float(c) and float(a)+float(c)>float(b) and float(c)+float(b)>float(a): return True else: return False a = input('Side a: ') b = input('Side b: ') c = input('Side c: ') if is_triangle(a, b, c): print('YES') else: print('Again')
1
1
reasoning
Otherwise, it is recognized as a string. Then the meaning as a number disappears.
cs1qa
null
null
null
null
null
Question: OK~ Please explain why the input value is float and int like float(a) in task2 and int(k) in task3~ Code: def is_triangle(a, b, c): if float(a)+float(b)>float(c) and float(a)+float(c)>float(b) and float(c)+float(b)>float(a): return True else: return False a = input('Side a: ') b =...
2
2
TA
What does jump_one_hurdle in Task 3 do?
from cs1robots import * load_world('worlds/hurdles1.wld') #load_world('worlds/hurdles2.wld') #load_world('worlds/hurdles3.wld') my_robot = Robot() my_robot.set_trace("blue") a=0 def turnright(): my_robot.turn_left() my_robot.turn_left() my_robot.turn_left() def check(): if my_robot.on_beeper()==True: ...
18
29
variable
If there is a wall in front of the robot, it goes over the wall, and if there is no wall, it moves forward one space.
cs1qa
null
null
null
null
null
Question: What does jump_one_hurdle in Task 3 do? Code: from cs1robots import * load_world('worlds/hurdles1.wld') #load_world('worlds/hurdles2.wld') #load_world('worlds/hurdles3.wld') my_robot = Robot() my_robot.set_trace("blue") a=0 def turnright(): my_robot.turn_left() my_robot.turn_left() my_robot.tu...
2
1
TA
I'm going to check it now. Can you explain how you made it for each task in the meantime?
from cs1robots import * load_world('worlds/harvest3.wld') hubo=Robot(beepers=6) hubo.set_trace("blue") def plant(): if not hubo.on_beeper(): hubo.drop_beeper() def st1(): for i in range(5): hubo.move() plant() hubo.turn_left() hubo.move() plant() hubo.turn_left() fo...
9
39
code_explain
In task2, in the function of task1, if there is no beeper, only the function is changed to leave the beeper.
cs1qa
null
null
null
null
null
Question: I'm going to check it now. Can you explain how you made it for each task in the meantime? Code: from cs1robots import * load_world('worlds/harvest3.wld') hubo=Robot(beepers=6) hubo.set_trace("blue") def plant(): if not hubo.on_beeper(): hubo.drop_beeper() def st1(): for i in range(5): ...
10
0
TA
Please explain briefly one by one what the attributes of the created Car class are.
from cs1graphics import * from time import sleep canvas = Canvas (900, 600) canvas.setBackgroundColor("light blue") class Car(object): def __init__(self, bodycolor='Blue', wheelcolor='Grey',state = 'slow' ): self.bodycolor = bodycolor self.wheelcolor = wheelcolor self.state = s...
7
51
variable
The remaining attributes are car, body, wheel1, and wheel2, which represent the whole car, the body of the car, and two squashes respectively.
cs1qa
null
null
null
null
null
Question: Please explain briefly one by one what the attributes of the created Car class are. Code: from cs1graphics import * from time import sleep canvas = Canvas (900, 600) canvas.setBackgroundColor("light blue") class Car(object): def __init__(self, bodycolor='Blue', wheelcolor='Grey',state = 'slo...
3
1
TA
Which part of task2 puts down all beepers?
from cs1robots import * # Your code must work for all world files below. load_world( "worlds/trash1.wld" ) # load_world( "worlds/trash2.wld" ) hubo = Robot() def turn_right(): hubo.turn_left() hubo.turn_left() hubo.turn_left() def turn(): hubo.turn_left() hubo.turn_left() while hubo.front_is_clear(...
24
25
code_explain
This is a while statement that puts down the beeper until the carries_beepers() function returns false.
cs1qa
null
null
null
null
null
Question: Which part of task2 puts down all beepers? Code: from cs1robots import * # Your code must work for all world files below. load_world( "worlds/trash1.wld" ) # load_world( "worlds/trash2.wld" ) hubo = Robot() def turn_right(): hubo.turn_left() hubo.turn_left() hubo.turn_left() def turn(): hu...
6
2
TA
Why is the condition like that in print_cards?
from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads = [] tries = 1 correct_list = [] def initialize(): # initial...
45
45
reasoning
This is because cards with numbers in the correct list must be turned over, cards with numbers that are not in the correct list must be turned over.
cs1qa
null
null
null
null
null
Question: Why is the condition like that in print_cards? Code: from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads ...
8
0
TA
How did you write the merge function in Task 1?
import elice_utils from time import sleep def merge(input_filenames, output_filename): with open(output_filename, 'w') as f: for filename in input_filenames: file = open(filename, 'r') for line in file.readlines(): f.write(line) file.close() merge(['kais...
3
9
variable
Simply open each input file and write it to a file (f) that combines the contents.
cs1qa
null
null
null
null
null
Question: How did you write the merge function in Task 1? Code: import elice_utils from time import sleep def merge(input_filenames, output_filename): with open(output_filename, 'w') as f: for filename in input_filenames: file = open(filename, 'r') for line in file.readlines(): ...
6
1
TA
Is there any reason you used for _ in line 14?
import random def drawing_integers(lb, ub, trials): """ Make a list of the integers :param lb: the lower bound of the integers :param ub: the upper bound of the integers :param trials: the number of trials :return: an integers list. Ex) [1, 4, 3, 5, 2] """ lst = [] for _ in ra...
13
15
reasoning
The variable used in the for-loop is not used anywhere, so I wrote it with a name that is not used well/
cs1qa
null
null
null
null
null
Question: Is there any reason you used for _ in line 14? Code: import random def drawing_integers(lb, ub, trials): """ Make a list of the integers :param lb: the lower bound of the integers :param ub: the upper bound of the integers :param trials: the number of trials :return: an integers l...
6
2
TA
How did you implement the two cards to show a picture when checking two cards?
from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads = [] tries = 1 correct_list = [] def initialize(): # initial...
104
116
code_explain
I modified the code of the print_cards function, so that the photos in the correct_list and or when num1 and num2 are displayed in the condition that the photos are visible!
cs1qa
null
null
null
null
null
Question: How did you implement the two cards to show a picture when checking two cards? Code: from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Su...
1
3
TA
Please explain task 4!
from cs1robots import* load_world('worlds/harvest1.wld') hubo=Robot(beepers=36) hubo.move() hubo.turn_left() def turn_right(): for i in range(3): hubo.turn_left() for i in range(3): for j in range(5): hubo.pick_beeper() hubo.move() hubo.pick_beeper() turn_right() hubo.mov...
0
26
code_explain
Because task4 needs to pass all the yellow beeper and minimize the path I thought about how to go by moving in zigzag At this time, the process of moving up/down and the process of changing direction I used the loop in.
cs1qa
null
null
null
null
null
Question: Please explain task 4! Code: from cs1robots import* load_world('worlds/harvest1.wld') hubo=Robot(beepers=36) hubo.move() hubo.turn_left() def turn_right(): for i in range(3): hubo.turn_left() for i in range(3): for j in range(5): hubo.pick_beeper() hubo.move() hubo.p...
2
2
TA
Why do you need the if-else statement in lines 28-31 of Task 3?
from cs1robots import * # Your code should work with any of the world files below. # TIP: Press Ctrl + '/' (or Cmd + '/' if you are using a Mac) # to comment out or restore the whole line of the code in the editor. load_world('worlds/hurdles1.wld') # load_world('worlds/hurdles2.wld') # load_world('worlds/hurdles3....
27
30
reasoning
If the front of the robot is empty, proceed until the hurdles come out, and if the front is blocked, you have to cross the hurdles.
cs1qa
null
null
null
null
null
Question: Why do you need the if-else statement in lines 28-31 of Task 3? Code: from cs1robots import * # Your code should work with any of the world files below. # TIP: Press Ctrl + '/' (or Cmd + '/' if you are using a Mac) # to comment out or restore the whole line of the code in the editor. load_world('world...
10
0
TA
What is a bird??(What variable does it contain?)
from cs1graphics import * from time import sleep _scene = None _world = None t = 0.2 def create_world(): global _scene, _world if _scene: raise RuntimeError("A world already exists!") _world = _World(500, 300) _scene = Canvas(_world.width, _world.height) _scene.setTitle("Mario World") ...
null
null
variable
layer() Contains eyes mouth wings body
cs1qa
null
null
null
null
null
Question: What is a bird??(What variable does it contain?) Code: from cs1graphics import * from time import sleep _scene = None _world = None t = 0.2 def create_world(): global _scene, _world if _scene: raise RuntimeError("A world already exists!") _world = _World(500, 300) _scene = Canvas...
3
3
TA
task 4 Why did you choose the window judgment method that way?
from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. my_robot = Robot(beepers=100, avenue=2, street=6, orientation='E') my_robot.set_trace('blue') # Now close all the windows in the...
24
39
reasoning
The corner at the bottom right of the rain2 map should be recognized as not a window, but in this case, the left side is not blocked after going one more space.
cs1qa
null
null
null
null
null
Question: task 4 Why did you choose the window judgment method that way? Code: from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. my_robot = Robot(beepers=100, avenue=2, street...
3
3
TA
How did you separate the windows and walls in task4??
from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. hubo = Robot(beepers=100, avenue=2, street=6, orientation='E') hubo.set_trace('blue') def turn_around() : hubo.turn_left() ...
24
37
code_explain
If the right side is empty, it is basically a window. If the right side is empty twice in a row, I used a right turn, not a window. Whether the right side is empty in the previous column or m, and whether the right side is empty in this column is indicated through k
cs1qa
null
null
null
null
null
Question: How did you separate the windows and walls in task4?? Code: from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. hubo = Robot(beepers=100, avenue=2, street=6, orientati...
3
3
TA
And secondly, it would be nice to briefly explain the algorithm you used when implementing Task4 Rain code.
from cs1robots import * # Your code must work for both of the worlds below. # load_world('worlds/rain1.wld') load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. # Now close all the windows in the house! def move(n=1): for i in range(n): h.move() def turn(n): for i in r...
19
60
code_explain
And in the case of task4, the inside of the house was turned counterclockwise, and if the right side is empty, it checks whether it is a wall in front of a corner or a window.
cs1qa
null
null
null
null
null
Question: And secondly, it would be nice to briefly explain the algorithm you used when implementing Task4 Rain code. Code: from cs1robots import * # Your code must work for both of the worlds below. # load_world('worlds/rain1.wld') load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. ...
3
3
TA
task 4 Why did you choose the window judgment method that way?
from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. my_robot = Robot(beepers=100, avenue=2, street=6, orientation='E') my_robot.set_trace('blue') # Now close all the windows in the...
24
39
reasoning
The corner at the bottom right of the rain2 map should be recognized as not a window, but in this case, the left side is not blocked after going one more space.
cs1qa
null
null
null
null
null
Question: task 4 Why did you choose the window judgment method that way? Code: from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. my_robot = Robot(beepers=100, avenue=2, street...
3
0
TA
Please explain how you used the loop in #1 to solve the problem!
from cs1robots import * create_world() r=Robot(orientation='W', avenue=7, street=5) r.set_trace('red') while not r.facing_north(): r.turn_left() r.turn_left() while r.front_is_clear(): r.move() r.turn_left() while r.front_is_clear(): r.move() r.turn_left()
8
21
code_explain
The first loop was not given an initial direction, so the robot turned left until it looked north. The second and third loops were made to move forward just before the front was blocked by a wall.
cs1qa
null
null
null
null
null
Question: Please explain how you used the loop in #1 to solve the problem! Code: from cs1robots import * create_world() r=Robot(orientation='W', avenue=7, street=5) r.set_trace('red') while not r.facing_north(): r.turn_left() r.turn_left() while r.front_is_clear(): r.move() r.turn_left() while r....
6
0
TA
Could you please explain what append does in Task 1?
def fibonacci(upper_bound): sequence=[0,1] n=0 while (sequence[n]+sequence[n+1])<1000: sequence.append(sequence[n]+sequence[n+1]) n+=1 return sequence print(fibonacci(1000))
4
4
variable
The append function is a function that adds an element to the end of the list. It serves to add a new Fibonacci number to the list to be returned.
cs1qa
null
null
null
null
null
Question: Could you please explain what append does in Task 1? Code: def fibonacci(upper_bound): sequence=[0,1] n=0 while (sequence[n]+sequence[n+1])<1000: sequence.append(sequence[n]+sequence[n+1]) n+=1 return sequence print(fibonacci(1000))
9
1
TA
Please explain how you implemented the draw_card of task 2
import random from cs1graphics import * path = './images/' suit_names = ['Clubs', 'Diamonds', 'Hearts', 'Spades'] face_names = ['Ace', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King'] value = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] bj_board = Canvas(600, 400, 'dark green', 'Black Jack 10...
77
121
code_explain
Using the for statement as much as the card length of the dealer and player, an image was added to the board with a card spacing of 10 and a depth difference of 10.
cs1qa
null
null
null
null
null
Question: Please explain how you implemented the draw_card of task 2 Code: import random from cs1graphics import * path = './images/' suit_names = ['Clubs', 'Diamonds', 'Hearts', 'Spades'] face_names = ['Ace', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King'] value = [11, 2, 3, 4, 5, 6, 7, 8, ...
5
0
TA
Yes, please explain task 1!
balance = 0 def deposit(money) : # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance ################# ### implement ### ################# # Do something on here ! pass global balance ...
0
72
code_explain
Case 1 I changed the value of the variable balance using global Decide which function to execute using the input function In the case of deposit and withdrawal, the amount of change was also input and applied to the balance. If '' is inputted, the process is finished using the return function.
cs1qa
null
null
null
null
null
Question: Yes, please explain task 1! Code: balance = 0 def deposit(money) : # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance ################# ### implement ### ################# # Do someth...
4
0
TA
Task 1. Please explain what are l, k, s, respectively
from cs1robots import * load_world("worlds/add34.wld") hubo=Robot() # hubo.set_trace("blue") # hubo.set_pause(1) hubo.turn_left() hubo.move() def turn_right(): for i in range (3): hubo.turn_left() turn_right() while hubo.front_is_clear(): hubo.move() k=0 l=0 s = 0 while True: while hubo.on_beeper():...
28
30
variable
k is the value of beeper on the first line, l is the value of beeper on the second line and s is 1 or 0 depending on does l+k more than 9 or not
cs1qa
null
null
null
null
null
Question: Task 1. Please explain what are l, k, s, respectively Code: from cs1robots import * load_world("worlds/add34.wld") hubo=Robot() # hubo.set_trace("blue") # hubo.set_pause(1) hubo.turn_left() hubo.move() def turn_right(): for i in range (3): hubo.turn_left() turn_right() while hubo.front_is_clear...
1
0
TA
Could you please explain what functions hubo_run() and hubo_round() are respectively?
from cs1robots import* create_world() hubo=Robot() def hubo_run(): for i in range(9): hubo.move() def hubo_round(): for i in range(3): hubo.turn_left() hubo.turn_left() hubo.set_trace('blue') hubo_run() hubo_round() hubo.move() hubo_round() hubo_run() hubo.turn_left() hubo.move() for i in rang...
5
10
variable
We set this as a function because it repeats moving forward by 9 spaces, and we set each as a function because we always take the action of turning left at the vertex 3 times.
cs1qa
null
null
null
null
null
Question: Could you please explain what functions hubo_run() and hubo_round() are respectively? Code: from cs1robots import* create_world() hubo=Robot() def hubo_run(): for i in range(9): hubo.move() def hubo_round(): for i in range(3): hubo.turn_left() hubo.turn_left() hubo.set_trace('blue...
4
0
TA
Briefly explain the name and action of the function you add in Task1!
from cs1robots import * load_world('worlds/add34.wld') my_robot = Robot() ''' Abstract, Final, Static class "Logic". Contains useful logics, which are frequently used. Since I started programming with Java, "global functions" do not look so good for me :D ''' class Logic: @staticmethod def rpt(fu, i, arg...
124
131
variable
solve_assignment. It repeats add_digit that adds the number of digits to the currently standing column, and performs retrieval and map end processing.
cs1qa
null
null
null
null
null
Question: Briefly explain the name and action of the function you add in Task1! Code: from cs1robots import * load_world('worlds/add34.wld') my_robot = Robot() ''' Abstract, Final, Static class "Logic". Contains useful logics, which are frequently used. Since I started programming with Java, "global functions" do ...
1
4
TA
Finally, I'll ask you to explain task5.
from cs1robots import* load_world('worlds/harvest2.wld') hubo=Robot(beepers=36) for i in range(5): hubo.move() hubo.turn_left() hubo.move() def turn_right(): for i in range(3): hubo.turn_left() for i in range(6): for j in range(5): hubo.pick_beeper() turn_right() hubo.mov...
0
30
code_explain
Task5 seems to have multiple answers. I’m going to take the process of picking up the beeper in the diagonal direction I thought I could repeat it 6 times I used a loop Depending on the condition of i, the process of moving to the next diagonal I think it should be a little different, so only that part I used condition...
cs1qa
null
null
null
null
null
Question: Finally, I'll ask you to explain task5. Code: from cs1robots import* load_world('worlds/harvest2.wld') hubo=Robot(beepers=36) for i in range(5): hubo.move() hubo.turn_left() hubo.move() def turn_right(): for i in range(3): hubo.turn_left() for i in range(6): for j in range(5): ...
5
0
TA
Is there any reason I used if-pass in task1??
balance = 0 def deposit(money) : # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance ################# ### implement ### ################# if money>0: pass print("You deposited " + str(m...
46
47
reasoning
I don't think I need it
cs1qa
null
null
null
null
null
Question: Is there any reason I used if-pass in task1?? Code: balance = 0 def deposit(money) : # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance ################# ### implement ### ################# ...
1
2
TA
Can you explain the climb_up(n) function??
import cs1robots as cr cr.load_world("worlds/newspaper.wld") hubo=cr.Robot(beepers=1) def turn_right(): for i in range(3): hubo.turn_left() def climb_up(n): for i in range(n): hubo.turn_left() hubo.move() turn_right() hubo.move() hubo.move() def climb_...
9
16
variable
The climb_up(n) function implies that the robot climbs the stairs n times. When I was right in front of the chin on the stairs
cs1qa
null
null
null
null
null
Question: Can you explain the climb_up(n) function?? Code: import cs1robots as cr cr.load_world("worlds/newspaper.wld") hubo=cr.Robot(beepers=1) def turn_right(): for i in range(3): hubo.turn_left() def climb_up(n): for i in range(n): hubo.turn_left() hubo.move() tu...
6
2
TA
Please explain the is_valid function in step 3
from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads = [] tries = 1 correct_list = [] def initialize(): # initial...
78
91
variable
The is_valid() function determines whether num1 and num2 are in the correct_list or is the same, or whether they are numbers in the correct range, and only then advances to the next.
cs1qa
null
null
null
null
null
Question: Please explain the is_valid function in step 3 Code: from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads ...
1
4
TA
In task 5, the range was set to (5, 0, -2) in the for statement. Please explain how to write the path using this.
from cs1robots import * import time load_world('worlds/harvest2.wld') hubo = Robot(beepers=25) sleep_time = 0.1 def turn_right(): for i in range(3): hubo.turn_left() def pick(): if hubo.on_beeper(): time.sleep(sleep_time) hubo.pick_beeper() for i in range(5): hubo.move() for i in...
19
63
code_explain
Using the method of picking up beepers like a snail shell turns, I picked up the beeper while spinning while eating 5 for the first wheel and 3 for the second.
cs1qa
null
null
null
null
null
Question: In task 5, the range was set to (5, 0, -2) in the for statement. Please explain how to write the path using this. Code: from cs1robots import * import time load_world('worlds/harvest2.wld') hubo = Robot(beepers=25) sleep_time = 0.1 def turn_right(): for i in range(3): hubo.turn_left() def pi...
6
2
TA
Why is the condition like that in print_cards?
from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads = [] tries = 1 correct_list = [] def initialize(): # initial...
45
45
reasoning
This is because cards with numbers in the correct list must be turned over, cards with numbers that are not in the correct list must be turned over.
cs1qa
null
null
null
null
null
Question: Why is the condition like that in print_cards? Code: from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads ...
3
2
TA
task3 You're very neat, is there a reason you didn't put 44-47 in the for statement??
from cs1robots import * # Your code must work with any of the world files below. load_world('worlds/trash3.wld') # load_world('worlds/trash4.wld') hubo= Robot() hubo.set_trace('blue') def pick_all(): while hubo.on_beeper(): hubo.pick_beeper() def pick_go(): pick_all() while hubo.front_is_clear(): ...
42
54
reasoning
It’s just because I didn’t put it in the zigzag assignment I did last time. It runs fine even if I just erase it
cs1qa
null
null
null
null
null
Question: task3 You're very neat, is there a reason you didn't put 44-47 in the for statement?? Code: from cs1robots import * # Your code must work with any of the world files below. load_world('worlds/trash3.wld') # load_world('worlds/trash4.wld') hubo= Robot() hubo.set_trace('blue') def pick_all(): while hub...
3
3
TA
Yes, simply explain closing_door!
from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. my_robot = Robot(beepers=100, avenue=2, street=6, orientation='E') # Now close all the windows in the house! my_robot.set_pause...
15
27
variable
Because all the windows are 1 space If the left side is empty, drop the beeper Even after moving forward, if it is empty, it is judged as a corner, not a window. Come back and retrieve the beeper and turn Or keep going It’s the function set up like that
cs1qa
null
null
null
null
null
Question: Yes, simply explain closing_door! Code: from cs1robots import * # Your code must work for both of the worlds below. load_world('worlds/rain1.wld') # load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. my_robot = Robot(beepers=100, avenue=2, street=6, orientation='E') # Now c...
1
0
TA
Please explain the zigzag function of task1.
from cs1robots import * create_world() hubo=Robot() hubo.set_trace('blue') def go_straight(): for i in range(9): hubo.move() def turn_right(): for i in range(3): hubo.turn_left() def zigzag(): hubo.turn_left() go_straight() turn_right() hubo.move() turn_right() go_straight() for i in range(4): ...
10
16
variable
In order to use the for statement for the robot, the zigzag function defines a zigzag function that rotates left, goes up, goes right, goes forward once, goes right, goes down again, and descends back to the last line.
cs1qa
null
null
null
null
null
Question: Please explain the zigzag function of task1. Code: from cs1robots import * create_world() hubo=Robot() hubo.set_trace('blue') def go_straight(): for i in range(9): hubo.move() def turn_right(): for i in range(3): hubo.turn_left() def zigzag(): hubo.turn_left() go_straight() turn_right() ...
5
1
TA
Please explain how you used the layer in task 2 and the movement of each shape you created.
from cs1graphics import * from time import sleep from math import sin, cos,pi def draw_animal(): # Implement this function. nature = Canvas(1000,600) nature.setBackgroundColor('skyblue') global Olaf Olaf = Layer() # Form Olaf's Body# def create_body(): cir=Circle(50,Point(0,50...
0
76
code_explain
After creating the snowman's body, arms, and eyes, and adding them to the layer, I used the Layer to move the layer so that the body, arms, and eyes all move at once, and rotate was used to make the snowman move and the arms rotate.
cs1qa
null
null
null
null
null
Question: Please explain how you used the layer in task 2 and the movement of each shape you created. Code: from cs1graphics import * from time import sleep from math import sin, cos,pi def draw_animal(): # Implement this function. nature = Canvas(1000,600) nature.setBackgroundColor('skyblue') ...
5
0
TA
What is the function of the global keyword in Task 1?
balance = 0 def deposit(money): # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance print('You deposited %d won' % money) global balance balance=balance+money # Do something on here ! def withdrawal(mone...
0
53
variable
Even if a variable has a value by operating within a function, it is impossible to use a local variable outside unless it is mapped to an external variable using return. By using the global keyword, the converted variable's value can be used outside the function.
cs1qa
null
null
null
null
null
Question: What is the function of the global keyword in Task 1? Code: balance = 0 def deposit(money): # Input : (Integer) The amount of money that a user wants to deposit # Output : (None) No Output # Add the money to the current balance print('You deposited %d won' % money) global balance ...
8
2
TA
And %4.1f Please explain what happens when you print it using this
import elice_utils f = open("tpmon.txt","r") year = 1722 first_line = f.readline() while True: s = f.readline() if not s: break s.strip() l = s.split() flist = list(map(float, l)) wint_avg = (flist[0]+flist[1])/2 summ_avg = (flist[6]+flist[7])/2 year +=1 print('%d: %6.1f / ...
16
16
variable
In %4.1f, the total number of digits is limited to 4 digits and the number of digits after the decimal point is limited to one digit, so if the number of digits exceeds this range, it will be rounded up and printed.
cs1qa
null
null
null
null
null
Question: And %4.1f Please explain what happens when you print it using this Code: import elice_utils f = open("tpmon.txt","r") year = 1722 first_line = f.readline() while True: s = f.readline() if not s: break s.strip() l = s.split() flist = list(map(float, l)) wint_avg = (flist[0]...
4
1
TA
Why should we apply float() after receiving input() in Task 2?
a =float(input('Side a: ')) print('Value of a is', a) b = float(input('Side b: ')) print('Value of b is', b) c = float(input('Side c: ')) print('Value of c is', c) def is_triangle(a, b, c): if a<b: if b<c: l=c m=b s=a else: l=b m=a ...
0
0
reasoning
Just input() recognizes it as a string, so you have to add float() to recognize it as a number!
cs1qa
null
null
null
null
null
Question: Why should we apply float() after receiving input() in Task 2? Code: a =float(input('Side a: ')) print('Value of a is', a) b = float(input('Side b: ')) print('Value of b is', b) c = float(input('Side c: ')) print('Value of c is', c) def is_triangle(a, b, c): if a<b: if b<c: l=c ...
5
1
TA
Are draw_animal() and show_animation() purposely created separately??
from cs1graphics import * from time import sleep def draw_animal(): # Implement this function. paper = Canvas() paper.setWidth(500) paper.setHeight(200) Tank = Layer() tire1 = Circle(12, Point(-12, -5)) tire2 = Circle(12, Point(12, -5)) tire3 = Circle(12, Point(35, -5)) ti...
null
null
reasoning
Oh, it wasn't on purpose, but I think it happened because I tried to print it out with the animation
cs1qa
null
null
null
null
null
Question: Are draw_animal() and show_animation() purposely created separately?? Code: from cs1graphics import * from time import sleep def draw_animal(): # Implement this function. paper = Canvas() paper.setWidth(500) paper.setHeight(200) Tank = Layer() tire1 = Circle(12, Point(-12...
6
0
TA
What is the role of f_temp in task1?
def fibonacci(upper_bound): f1=0 f2=1 fibonacci=[f1,f2] f_temp=0 while 1: f_temp=f1 f_temp+=f2 if f_temp>upper_bound: break else: fibonacci.append(f_temp) f1=f2 f2=f_temp return fibonacci print(fibonacci(1000))
1
14
variable
After finding f_n, you need both f_n and f_(n-1) to find f_(n+1). At this time, f_n is stored for a while!
cs1qa
null
null
null
null
null
Question: What is the role of f_temp in task1? Code: def fibonacci(upper_bound): f1=0 f2=1 fibonacci=[f1,f2] f_temp=0 while 1: f_temp=f1 f_temp+=f2 if f_temp>upper_bound: break else: fibonacci.append(f_temp) f1=f2 f2=...
6
0
TA
Please explain what upper_bound does in Task 1
def fibonacci(upper_bound): a=0 b=1 c=0 result=[a,b] while a+b<=upper_bound: c=a+b result.append(c) a=b b=c return result print(fibonacci(1000))
0
10
variable
In task 1, upper_bound is used as a role to print a list of Fibonacci sequences until the value of a+b is less than upper_bound.
cs1qa
null
null
null
null
null
Question: Please explain what upper_bound does in Task 1 Code: def fibonacci(upper_bound): a=0 b=1 c=0 result=[a,b] while a+b<=upper_bound: c=a+b result.append(c) a=b b=c return result print(fibonacci(1000))
6
0
TA
What is the sum of
def fibonacci(upper_bound): a = [0, 1] i=0 while (a[i+1]+ a[i]) < upper_bound: x = a[i+1]+ a[i] a.append(x) i= i+1 return a print(fibonacci(1000))
0
7
variable
Two consecutive numbers in the list
cs1qa
null
null
null
null
null
Question: What is the sum of Code: def fibonacci(upper_bound): a = [0, 1] i=0 while (a[i+1]+ a[i]) < upper_bound: x = a[i+1]+ a[i] a.append(x) i= i+1 return a print(fibonacci(1000))
5
0
TA
Task 1: Explain what each of the global variables a, b, c is!
from cs1robots import * #load_world('worlds/add1.wld') #load_world('worlds/add2.wld') load_world('worlds/add34.wld') hubo = Robot() hubo.set_trace('blue') def turn_right(): hubo.turn_left() hubo.turn_left() hubo.turn_left() a=1 b=0 c=0 def read(): global a,b,c while hubo.front_is_clear(): h...
11
27
variable
a is the exponent of 10 (1 digit 1, 10 digit 10), c is each digit, b is the total
cs1qa
null
null
null
null
null
Question: Task 1: Explain what each of the global variables a, b, c is! Code: from cs1robots import * #load_world('worlds/add1.wld') #load_world('worlds/add2.wld') load_world('worlds/add34.wld') hubo = Robot() hubo.set_trace('blue') def turn_right(): hubo.turn_left() hubo.turn_left() hubo.turn_left() a=...
8
0
TA
Please explain the ‘r’ and ‘w’ variables of open().
from time import sleep import elice_utils def merge(input_filenames, output_filename): d = open(output_filename , 'w') a = len(input_filenames) for i in range(a): c = input_filenames[i] f = open(c, 'r') b = f.readlines() for x in range(len(b)): d.write(b[x]) ...
4
4
variable
r is used to read files and w is used to write files.
cs1qa
null
null
null
null
null
Question: Please explain the ‘r’ and ‘w’ variables of open(). Code: from time import sleep import elice_utils def merge(input_filenames, output_filename): d = open(output_filename , 'w') a = len(input_filenames) for i in range(a): c = input_filenames[i] f = open(c, 'r') b = f.rea...
8
0
TA
Please briefly explain what the meaning of "r" and "w" used to open!
from time import sleep import elice_utils def merge(input_filenames, output_filename): # Implement here # ... file1=open(output_filename,"w") for file_names in input_filenames: file2=open(file_names,"r") for line in file2: file1.write(line) file2.close() file1.cl...
6
8
variable
'r' means open for reading (default),'w' means open for writing, truncating the file first.
cs1qa
null
null
null
null
null
Question: Please briefly explain what the meaning of "r" and "w" used to open! Code: from time import sleep import elice_utils def merge(input_filenames, output_filename): # Implement here # ... file1=open(output_filename,"w") for file_names in input_filenames: file2=open(file_names,"r") ...
5
1
TA
Is that because I don't think I can access the ship and balls in show_animation??
from cs1graphics import * from time import sleep def draw_animal(): # Implement this function. sun = Circle(18, Point(430, 220)) sun.setFillColor('yellow') sun.setDepth(30) paper.add(sun) flare = Circle(24, Point(430, 220)) flare.setFillColor('red') flare.setDepth(40) paper.a...
51
56
reasoning
Yes, yes, it seemed to be accessible only if the declaration was made globally outside.
cs1qa
null
null
null
null
null
Question: Is that because I don't think I can access the ship and balls in show_animation?? Code: from cs1graphics import * from time import sleep def draw_animal(): # Implement this function. sun = Circle(18, Point(430, 220)) sun.setFillColor('yellow') sun.setDepth(30) paper.add(sun) ...
1
4
TA
Why did you make an exception after making two repetitions?
from cs1robots import * load_world("worlds/harvest2.wld") hubo=Robot(beepers=1) hubo.set_trace("blue") def turn_right(): for i in range(3): hubo.turn_left() def harvest_up(): for i in range(5): hubo.pick_beeper() turn_right() hubo.move() hubo.turn_left() hubo.mov...
38
45
reasoning
Since the process of changing the direction was specified as a function, an unnecessary change of direction occurred at the end when it was repeated 3 times, so after repeating 2 times to subtract the part, an exception without trun2 was made separately.
cs1qa
null
null
null
null
null
Question: Why did you make an exception after making two repetitions? Code: from cs1robots import * load_world("worlds/harvest2.wld") hubo=Robot(beepers=1) hubo.set_trace("blue") def turn_right(): for i in range(3): hubo.turn_left() def harvest_up(): for i in range(5): hubo.pick_beeper() ...
4
0
TA
Please tell me the name of the function you are adding in Task1!
from cs1robots import * # load_world("worlds/add1.wld") # load_world("worlds/add2.wld") load_world("worlds/add34.wld") hubo=Robot() def turn_right(): for i in range (3): hubo.turn_left() hubo.turn_left() hubo.move() turn_right() def run1(): for i in range(9): hubo.move() def check1(): ...
20
58
variable
Whenever the beeper was picked up using the check function, the variable value was added by 1, and //10 was used to solve the case where the sum of the beepers exceeded 10.
cs1qa
null
null
null
null
null
Question: Please tell me the name of the function you are adding in Task1! Code: from cs1robots import * # load_world("worlds/add1.wld") # load_world("worlds/add2.wld") load_world("worlds/add34.wld") hubo=Robot() def turn_right(): for i in range (3): hubo.turn_left() hubo.turn_left() hubo.move() turn...
3
3
TA
How did you determine if it was a window? Is there a reason you're so salty?
from cs1robots import * # Your code must work for both of the worlds below. # load_world('worlds/rain1.wld') load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. tim= Robot(beepers=100, avenue=2, street=6, orientation='E') # Now close all the windows in the house! tim.set_trace('blue') de...
18
43
reasoning
I went one step forward and checked if there was a wall. If we just check that the left side is empty, we have confirmed that a problem occurs in the corner entering the inside, and to prevent this, we checked again.
cs1qa
null
null
null
null
null
Question: How did you determine if it was a window? Is there a reason you're so salty? Code: from cs1robots import * # Your code must work for both of the worlds below. # load_world('worlds/rain1.wld') load_world('worlds/rain2.wld') # Initialize your robot at the door of the house. tim= Robot(beepers=100, avenue=2...
4
0
TA
Why did you use the while statement??
def fibonacci(upper_bound): pass result = [0, 1] while True: result.append(result[-1]+result[-2]) if result[-1] >= upper_bound: result.remove(result[-1]) return(result) print(fibonacci(1000))
2
7
reasoning
It is to repeat until the upper_bound is exceeded, and when the condition is satisfied, it is finished with return.
cs1qa
null
null
null
null
null
Question: Why did you use the while statement?? Code: def fibonacci(upper_bound): pass result = [0, 1] while True: result.append(result[-1]+result[-2]) if result[-1] >= upper_bound: result.remove(result[-1]) return(result) print(fibonacci(1000))
6
2
TA
What is the case for num1 and num2 that return False when is_valid?
from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") cards = [] num_pads = [] tries = 1 def initialize(): # initialize cards for i...
58
68
variable
If the number of cards already matched, if the two numbers are the same, if it exceeds the range of 0 to 23
cs1qa
null
null
null
null
null
Question: What is the case for num1 and num2 that return False when is_valid? Code: from cs1graphics import * import time import random canvas = Canvas(640, 580) canvas.setTitle("Memento") path = "./images/" names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg", "Minsuk.jpg", "Sangjae.jpg", "Sungeun.jpg") ...
3
4
TA
Why do you need to nest two for statements when implementing Task 5?
from cs1media import * # This code converts an image into a black & white poster. yellow = (255, 255, 0) blue = (0, 0, 255) green = (0, 255, 0) image = load_picture('./images/minion.jpg') width, height = image.size() for y in range(height): for x in range(width): r, g, b = image.get(x, y) avera...
12
13
reasoning
This is to consider all points by multiplying the two.
cs1qa
null
null
null
null
null
Question: Why do you need to nest two for statements when implementing Task 5? Code: from cs1media import * # This code converts an image into a black & white poster. yellow = (255, 255, 0) blue = (0, 0, 255) green = (0, 255, 0) image = load_picture('./images/minion.jpg') width, height = image.size() for y in r...
End of preview. Expand in Data Studio

Dataset Card for "codeqa_v2"

More Information needed

Downloads last month
10