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 | Could you explain task 4's block function? | from cs1robots import *
# Your code must work for both of the worlds below.
load_world('worlds/rain2.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('red')
# Now close all the windows in the house!
de... | 14 | 21 | variable | I chose a clockwise rotation method, in which case the block is a function that makes the beeper drop when there is no wall (when the window is open) while going straight along one side (until it is blocked by the other side) | cs1qa | null | null | null | null | null | Question:
Could you explain task 4's block function?
Code:
from cs1robots import *
# Your code must work for both of the worlds below.
load_world('worlds/rain2.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... |
6 | 2 | student | Can you explain what the print_cards() function is about in 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 = 0
correct_list = []
def initialize():
# initial... | 38 | 59 | code_understanding | It is a function that prints cards on the screen based on the current information. | cs1qa | null | null | null | null | null | Question:
Can you explain what the print_cards() function is about in 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")
card... |
1 | 2 | TA | Please briefly explain the functions up and down that you wrote down in number 3 as well! | from cs1robots import*
load_world('worlds/newspaper.wld')
hubo=Robot(beepers=10)
hubo.set_trace('blue')
def up():
for i in range(4):
hubo.move()
hubo.turn_left()
hubo.move()
for i in range(3):
hubo.turn_left()
hubo.move()
up()
hubo.move()
hubo.drop_beeper()
def down():
for i in range(4):
hubo.move()
... | 4 | 22 | variable | Up is a function that represents going up all the stairs, so we repeated four times to go up one stair with a for statement, and because down is a function that indicates going down all stairs, we repeated going down one stair with a for statement. | cs1qa | null | null | null | null | null | Question:
Please briefly explain the functions up and down that you wrote down in number 3 as well!
Code:
from cs1robots import*
load_world('worlds/newspaper.wld')
hubo=Robot(beepers=10)
hubo.set_trace('blue')
def up():
for i in range(4):
hubo.move()
hubo.turn_left()
hubo.move()
for i in range(3):
hubo.t... |
6 | 2 | student | Why does! | 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... | 93 | 108 | code_understanding | Because the while statement has to run until correct_list does not contain all the numbers
I made it not equal | cs1qa | null | null | null | null | null | Question:
Why does!
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 = []
tries = 1
correct_list = []
de... |
3 | 1 | TA | Please tell me about the function and role of the plant() function. | from cs1robots import *
load_world('worlds/harvest3.wld')
hubo = Robot(beepers=100)
hubo.set_trace("blue")
def turn_right():
for i in range(3):
hubo.turn_left()
def plant_beeper(): # If hubo is not on beeper, plant a beeper
if not hubo.on_beeper():
hubo.drop_beeper()
# Scans 2 floors(rows) wh... | 9 | 44 | variable | This is the code that checks if there is no beeper where the robot is located, and if not | cs1qa | null | null | null | null | null | Question:
Please tell me about the function and role of the plant() function.
Code:
from cs1robots import *
load_world('worlds/harvest3.wld')
hubo = Robot(beepers=100)
hubo.set_trace("blue")
def turn_right():
for i in range(3):
hubo.turn_left()
def plant_beeper(): # If hubo is not on beeper, plant a be... |
1 | 4 | TA | What is the role of carrots? | from cs1robots import *
load_world("worlds/harvest2.wld")
hubo = Robot()
carrots = 0
marker = 0
hubo.set_trace("blue") ##optional
def turnright():
for i in range(3):
hubo.turn_left()
def proceed():
for i in range(2):
hubo.move()
#before collecting halfway
def righty():
global carr... | 61 | 97 | variable | carrots is the number of beepers the robot has collected | cs1qa | null | null | null | null | null | Question:
What is the role of carrots?
Code:
from cs1robots import *
load_world("worlds/harvest2.wld")
hubo = Robot()
carrots = 0
marker = 0
hubo.set_trace("blue") ##optional
def turnright():
for i in range(3):
hubo.turn_left()
def proceed():
for i in range(2):
hubo.move()
#before ... |
1 | 0 | TA | Please briefly explain what a lambda function is | from cs1robots import *
create_world()
rb = Robot() # \Robo_HEAD/
def rpt(fu, i, args=()): # repeat
for x in range(i):
fu.__call__(*args)
tl = lambda : rb.turn_left()
tr = lambda : rpt(rb.turn_left, 3)
mv = lambda i : rpt(rb.move, i)
def setup():
tl()
rb.set_trace("blue")
def foo():
mv(9); t... | 8 | 10 | variable | Anonymous function, function without name
It is derived from the lambda calculation method suggested by Alonzo Church.
If func1 = lambda x: 2x
def func1(x):
return 2*x
I feel like | cs1qa | null | null | null | null | null | Question:
Please briefly explain what a lambda function is
Code:
from cs1robots import *
create_world()
rb = Robot() # \Robo_HEAD/
def rpt(fu, i, args=()): # repeat
for x in range(i):
fu.__call__(*args)
tl = lambda : rb.turn_left()
tr = lambda : rpt(rb.turn_left, 3)
mv = lambda i : rpt(rb.move, i)
def... |
3 | 0 | TA | Explain lines 8-9 in task1 | from cs1robots import *
create_world()
my_robot = Robot(orientation='W', avenue=7, street=5)
my_robot.set_trace('blue')
while not my_robot.facing_north():
my_robot.turn_left()
my_robot.turn_left()
while my_robot.front_is_clear():
my_robot.move()
my_robot.turn_left()
while my_robot.front_is_clear():
my_r... | 7 | 8 | code_explain | Turn until you see north, and when you see north, you look west by line 10 | cs1qa | null | null | null | null | null | Question:
Explain lines 8-9 in task1
Code:
from cs1robots import *
create_world()
my_robot = Robot(orientation='W', avenue=7, street=5)
my_robot.set_trace('blue')
while not my_robot.facing_north():
my_robot.turn_left()
my_robot.turn_left()
while my_robot.front_is_clear():
my_robot.move()
my_robot.turn_le... |
2 | 0 | TA | What is the role of the move1() function in Task1? | from cs1robots import *
load_world("worlds/harvest3.wld")
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def move1():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
def lap():
for i in range(5):
move1()
hubo.t... | 9 | 12 | variable | The move1() function is to pick up the beeper if the robot moves and there is a beeper at that location. | cs1qa | null | null | null | null | null | Question:
What is the role of the move1() function in Task1?
Code:
from cs1robots import *
load_world("worlds/harvest3.wld")
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def move1():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
... |
2 | 3 | TA | Explain the farmer function in task 4 | from cs1robots import *
load_world('worlds/harvest1.wld')
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
def harvest():
hubo.move()
while hubo.on_beeper():
hubo.pick_beeper()
while hubo.front_is_clear():
harvest()
while hu... | 24 | 38 | variable | And the farmer function is defined to pick up the beeper by continuing to execute the harvest function, a function that picks up the beeper, while moving in zigzag while moving one line to the right and one line to the left as a unit. | cs1qa | null | null | null | null | null | Question:
Explain the farmer function in task 4
Code:
from cs1robots import *
load_world('worlds/harvest1.wld')
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
def harvest():
hubo.move()
while hubo.on_beeper():
hubo.pick_beepe... |
4 | 1 | TA | Why should we apply float() after receiving input() in Task 2? |
def is_triangle(a, b, c):
if ((a+b>c) and (b+c>a) and (c+a>b)):
return True
else:
return False
a = float(input('Side a: '))
b = float(input('Side b: '))
c = float(input('Side c: '))
if is_triangle(a, b, c):
print('YES')
else:
print('NO') | 1 | 14 | reasoning | This is because the input() function receives input in the form of a string. | cs1qa | null | null | null | null | null | Question:
Why should we apply float() after receiving input() in Task 2?
Code:
def is_triangle(a, b, c):
if ((a+b>c) and (b+c>a) and (c+a>b)):
return True
else:
return False
a = float(input('Side a: '))
b = float(input('Side b: '))
c = float(input('Side c: '))
if is_triangle(a, b, c):
print('YES... |
4 | 3 | TA | Why do you add 40 to the end of line 9 in the 4th task? | import math
sin = math.sin
pi = math.pi
cos = math.cos
for i in range(41) :
x = float(i) / 40.0 * 2 * pi
character_count_per_line = math.sin(x)+40*sin(x)+40# Change this line to print out sine curve correctly.
output_str = '#' * int(character_count_per_line)
print (output_str) | 7 | 10 | reasoning | I decided on the function, but I used trial and error a bit, but the first line was 40 #s. | cs1qa | null | null | null | null | null | Question:
Why do you add 40 to the end of line 9 in the 4th task?
Code:
import math
sin = math.sin
pi = math.pi
cos = math.cos
for i in range(41) :
x = float(i) / 40.0 * 2 * pi
character_count_per_line = math.sin(x)+40*sin(x)+40# Change this line to print out sine curve correctly.
output_str = '#... |
5 | 1 | student | Are geometry objects like tiger and sq_n also variables? | from cs1graphics import *
from time import sleep
world=Canvas(1200,1000)
world.setBackgroundColor("light blue")
world.setTitle("CS101 LAB5 Animation")
def draw_animal():
global tiger
global sq1
global sq2
global sq3
global sq4
global sq5
tiger=Layer()
sq1=Rectangle(160,75, Point(-80,-10... | 13 | 22 | code_understanding | Oh, it can be called a variable | cs1qa | null | null | null | null | null | Question:
Are geometry objects like tiger and sq_n also variables?
Code:
from cs1graphics import *
from time import sleep
world=Canvas(1200,1000)
world.setBackgroundColor("light blue")
world.setTitle("CS101 LAB5 Animation")
def draw_animal():
global tiger
global sq1
global sq2
global sq3
global ... |
9 | 1 | TA | What does assert do in the Card class? | import random
from cs1graphics import *
img_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 Jac... | 16 | 16 | variable | assert checks whether the face_names list and the suit_names list contain faces and suits! | cs1qa | null | null | null | null | null | Question:
What does assert do in the Card class?
Code:
import random
from cs1graphics import *
img_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, 1... |
1 | 4 | TA | Could you briefly explain the harvest up and down functions? | from cs1robots import*
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace("blue")
#hubo.set_pause(1)
def turn_right():
for i in range(3):
hubo.turn_left()
def contact():
hubo.turn_left()
for i in range(6):
hubo.move()
hubo.pick_beeper()
def harvest_down():
for i ... | 17 | 39 | variable | Harvest up diagonally up and harvest down diagonally down
There is also a change of direction in the code, so I used the harvest code at the end | cs1qa | null | null | null | null | null | Question:
Could you briefly explain the harvest up and down functions?
Code:
from cs1robots import*
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace("blue")
#hubo.set_pause(1)
def turn_right():
for i in range(3):
hubo.turn_left()
def contact():
hubo.turn_left()
for i in range(6)... |
1 | 0 | TA | What is turn_right()? | 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_st... | 9 | 11 | variable | It is a function that rotates to the right, but it does not have a function to rotate to the right, so it is a function made with three left turns! | cs1qa | null | null | null | null | null | Question:
What is turn_right()?
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 | 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 | 13 | 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 | How did you create the Task1 merge() function? | from time import sleep
import elice_utils
def merge(input_filenames, output_filename):
# Implement here
# ..
g=open(output_filename,'w')
for i in input_filenames:
f=open(i,'r')
for lines in f.readlines():
g.write(lines)
##g.write("\n")
##g.write("\n")
... | 2 | 13 | code_explain | While reading the input filename with the for statement, all opened files are read and written to the output file. | cs1qa | null | null | null | null | null | Question:
How did you create the Task1 merge() function?
Code:
from time import sleep
import elice_utils
def merge(input_filenames, output_filename):
# Implement here
# ..
g=open(output_filename,'w')
for i in input_filenames:
f=open(i,'r')
for lines in f.readlines():
g.wri... |
6 | 2 | TA | How did you implement showing all the pictures at the beginning | 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... | 98 | 103 | code_explain | Implemented in lines 99-104.
First, I appended 1 to 24 to the correct_list and then called print_cards to show the image.
Then, correct_list was cleared by doing correct_list.pop() 24 times.
Another call to print_cards was made to show only the numbers this time. | cs1qa | null | null | null | null | null | Question:
How did you implement showing all the pictures at the beginning
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")
car... |
8 | 0 | TA | Please explain code 1 | import elice_utils
from time import sleep
def merge(input_filenames, output_filename):
# Implement here
# ...
input_file = []
s = ""
for i in range(len(input_filenames)):
input_file.append(open(input_filenames[i], "r" ))
s = s + input_file[i].read() + "\n"
for i in range(len(inp... | 3 | 14 | code_explain | I read three text files with the read function and made them into one string to create an output file. | cs1qa | null | null | null | null | null | Question:
Please explain code 1
Code:
import elice_utils
from time import sleep
def merge(input_filenames, output_filename):
# Implement here
# ...
input_file = []
s = ""
for i in range(len(input_filenames)):
input_file.append(open(input_filenames[i], "r" ))
s = s + input_file[i]... |
6 | 2 | TA | Please explain the list called correct | 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... | 114 | 117 | variable | If the n number of correct is 1, the picture is printed at the card output stage, and if it is 0, the number card is printed at the card output stage. | cs1qa | null | null | null | null | null | Question:
Please explain the list called correct
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 = []
tri... |
9 | 0 | TA | What elements is the cards list in? | # Copy your "Memento" code from the task in Lab 6.
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 = ... | 31 | 36 | variable | The cards list is a list of currently 24 cards. | cs1qa | null | null | null | null | null | Question:
What elements is the cards list in?
Code:
# Copy your "Memento" code from the task in Lab 6.
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... |
1 | 3 | TA | Please explain each function | from cs1robots import *
load_world("worlds/harvest1.wld")
robot = Robot()
robot.set_trace("blue")
robot.set_pause(.1)
def turn_right():
for i in range(3):
robot.turn_left()
def one_cycle():
for j in range(5):
robot.move()
robot.pick_beeper()
robot.turn_left()
robot.move(... | 9 | 25 | variable | one_cycle() is a function used to pick up two lines of beeper, and set_next_position() is a function used to move to the next line. | cs1qa | null | null | null | null | null | Question:
Please explain each function
Code:
from cs1robots import *
load_world("worlds/harvest1.wld")
robot = Robot()
robot.set_trace("blue")
robot.set_pause(.1)
def turn_right():
for i in range(3):
robot.turn_left()
def one_cycle():
for j in range(5):
robot.move()
robot.pic... |
10 | 0 | TA | Would you please write in this chat room as much detail as possible about what animation you made and how you met each requirement in the description? | from cs1graphics import *
from time import sleep
_scene = None
_world = None
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")
_world.d... | null | null | code_explain | The overall animation content is an animation in which the apple on the tree falls and crushes due to the rain falling and the tree shakes. So, first, the gel first expresses the rain, and the leaves of the tree move on the canvas and the apple falls and crushes. | cs1qa | null | null | null | null | null | Question:
Would you please write in this chat room as much detail as possible about what animation you made and how you met each requirement in the description?
Code:
from cs1graphics import *
from time import sleep
_scene = None
_world = None
def create_world():
global _scene, _world
if _scene:
ra... |
4 | 2 | TA | What are the conditions for showing cards in print_card? | 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... | 54 | 54 | code_explain | print_card() only shows cards in the correct answer list | cs1qa | null | null | null | null | null | Question:
What are the conditions for showing cards in print_card?
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 = []... |
4 | 3 | TA | Can you briefly explain why you changed line 10 to 40+40*sin(x) in Task 4? | import math
sin = math.sin
pi = math.pi
#n = int(input())
for i in range(41) :
x = float(i) / 40.0 * 2 * pi
character_count_per_line = 40+40*sin(x) # Change this line to print out sine curve correctly.
output_str = '#' * int(character_count_per_line)
print (output_str) | 9 | 9 | reasoning | If you don't do that, the value is too small and the graph doesn't come out. So I changed it to show it well! | cs1qa | null | null | null | null | null | Question:
Can you briefly explain why you changed line 10 to 40+40*sin(x) in Task 4?
Code:
import math
sin = math.sin
pi = math.pi
#n = int(input())
for i in range(41) :
x = float(i) / 40.0 * 2 * pi
character_count_per_line = 40+40*sin(x) # Change this line to print out sine curve correctly.
out... |
3 | 1 | TA | Is there a reason you used while to give coins? | from cs1robots import *
# Your code must work for all world files below.
load_world( "worlds/trash1.wld" )
# load_world( "worlds/trash2.wld" )
hubo = Robot()
hubo.set_trace('red')
def go():
hubo.move()
while hubo.on_beeper():
hubo.pick_beeper()
while hubo.front_is_clear():
go()
hubo.turn_left()
... | 11 | 12 | reasoning | Well, if there are several coins apart, it’s just to pick them up | cs1qa | null | null | null | null | null | Question:
Is there a reason you used while to give coins?
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()
hubo.set_trace('red')
def go():
hubo.move()
while hubo.on_beeper():
hubo.pic... |
5 | 1 | TA | You defined a layer called crab in Task 2. What are the advantages of having a layer like this? | from cs1graphics import *
from time import sleep
r = Rectangle(800, 160)
r.setFillColor("beige")
c = Circle(50)
c.setFillColor("yellow")
crab = Layer()
body = Rectangle(140, 60, Point(0, -20))
body.setFillColor("orange")
crab.add(body)
eye1 = Circle(10, Point(-40, -60))
eye1.setFillColor("black")
crab.add(eye1)
... | 9 | 9 | reasoning | If you put a layer, you can move the shapes contained in that layer at once! | cs1qa | null | null | null | null | null | Question:
You defined a layer called crab in Task 2. What are the advantages of having a layer like this?
Code:
from cs1graphics import *
from time import sleep
r = Rectangle(800, 160)
r.setFillColor("beige")
c = Circle(50)
c.setFillColor("yellow")
crab = Layer()
body = Rectangle(140, 60, Point(0, -20))
body.... |
4 | 0 | TA | Please tell me the name of the function you are adding in Task1! | from cs1robots import *
cnt=0
def go(a):
for i in range(a):
slave.move()
def turn(a):
for i in range(a):
slave.turn_left()
def pick_all():
global cnt
while(slave.on_beeper()):
slave.pick_beeper()
cnt+=1
def drop_all():
global cnt
for i in range(cnt):
... | 34 | 46 | variable | First, number 1 is over_ten, which simply sums up the numbers above and below and then implements decimal rounding that needs to be executed. | cs1qa | null | null | null | null | null | Question:
Please tell me the name of the function you are adding in Task1!
Code:
from cs1robots import *
cnt=0
def go(a):
for i in range(a):
slave.move()
def turn(a):
for i in range(a):
slave.turn_left()
def pick_all():
global cnt
while(slave.on_beeper()):
slave.pick_beepe... |
4 | 3 | TA | Why do you add 40 to the end of line 9 in the 4th task? | import math
sin = math.sin
pi = math.pi
cos = math.cos
for i in range(41) :
x = float(i) / 40.0 * 2 * pi
character_count_per_line = math.sin(x)+40*sin(x)+40# Change this line to print out sine curve correctly.
output_str = '#' * int(character_count_per_line)
print (output_str) | 8 | 8 | reasoning | I decided on the function, but I used trial and error a bit, but the first line was 40 #s. | cs1qa | null | null | null | null | null | Question:
Why do you add 40 to the end of line 9 in the 4th task?
Code:
import math
sin = math.sin
pi = math.pi
cos = math.cos
for i in range(41) :
x = float(i) / 40.0 * 2 * pi
character_count_per_line = math.sin(x)+40*sin(x)+40# Change this line to print out sine curve correctly.
output_str = '#... |
1 | 4 | TA | Could you briefly explain the harvest up and down functions? | from cs1robots import*
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace("blue")
#hubo.set_pause(1)
def turn_right():
for i in range(3):
hubo.turn_left()
def contact():
hubo.turn_left()
for i in range(6):
hubo.move()
hubo.pick_beeper()
def harvest_down():
for i ... | 17 | 39 | variable | Harvest up diagonally up and harvest down diagonally down
There is also a change of direction in the code, so I used the harvest code at the end | cs1qa | null | null | null | null | null | Question:
Could you briefly explain the harvest up and down functions?
Code:
from cs1robots import*
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace("blue")
#hubo.set_pause(1)
def turn_right():
for i in range(3):
hubo.turn_left()
def contact():
hubo.turn_left()
for i in range(6)... |
1 | 0 | TA | I think you wrote the code separately for only the last half of the 4 laps. Can I ask why? | from cs1robots import *
create_world()
hubo=Robot()
hubo.turn_left()
hubo.set_trace('blue')
def turn_right():
for i in range (3):
hubo.turn_left()
for i in range(4):
for j in range(9):
hubo.move()
turn_right()
hubo.move()
turn_right()
for k in range(9):
hubo.move()
... | 11 | 24 | reasoning | Lastly, the path was shorter than the one in front, so if it moved like in the loop, it hit the wall and did it separately. | cs1qa | null | null | null | null | null | Question:
I think you wrote the code separately for only the last half of the 4 laps. Can I ask why?
Code:
from cs1robots import *
create_world()
hubo=Robot()
hubo.turn_left()
hubo.set_trace('blue')
def turn_right():
for i in range (3):
hubo.turn_left()
for i in range(4):
for j in range(9):
... |
3 | 3 | TA | How did you determine the last entrance? | from cs1robots import *
import time
# 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 win... | 18 | 18 | code_explain | The last entrance was fixed by running the while statement only when the location was not reached. | cs1qa | null | null | null | null | null | Question:
How did you determine the last entrance?
Code:
from cs1robots import *
import time
# 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, orienta... |
1 | 0 | TA | You wrote well with the for statement in Task1, but is there any reason you couldn't put lines 29~34 below in the for statement? | from cs1robots import*
create_world()
a=Robot()
def stride():
for i in range(9):
a.move()
def turn_right():
for i in range(3):
a.turn_left()
a.set_trace('blue')
for i in range(4):
a.turn_left()
stride()
turn_right()
a.move()
turn_right()
stride()
... | 18 | 33 | reasoning | If I try to do 5 repetitions, I hit the wall in the last step and cut it. | cs1qa | null | null | null | null | null | Question:
You wrote well with the for statement in Task1, but is there any reason you couldn't put lines 29~34 below in the for statement?
Code:
from cs1robots import*
create_world()
a=Robot()
def stride():
for i in range(9):
a.move()
def turn_right():
for i in range(3):
a.turn_le... |
4 | 2 | TA | Please explain along with the process which constants of the math module were used in Task3~ | import math
sin = math.sin
pi = math.pi
a = (input('How many steps? '))
for i in range(int(a)):
x = float(i) / 30.0 * 2 * pi
print (sin(x)) | 2 | 9 | code_explain | 3. Using sin and pi, the sin value is expressed up to the input step value. | cs1qa | null | null | null | null | null | Question:
Please explain along with the process which constants of the math module were used in Task3~
Code:
import math
sin = math.sin
pi = math.pi
a = (input('How many steps? '))
for i in range(int(a)):
x = float(i) / 30.0 * 2 * pi
print (sin(x)) |
5 | 1 | TA | Is there a reason that only the legs were made outside the function?? | from cs1graphics import *
from time import sleep
import random
def draw_animal():
# Implement this function.
canvas.setBackgroundColor('white')
body=Polygon(Point(170,200),Point(130,200),Point(120,270),Point(180,270))
body.setFillColor('light blue')
nup.add(body)
face=Ellipse(100,55,Point... | 53 | 86 | reasoning | The feet and legs move separately, so it looks like making it inside or outside, so I just made it outside! | cs1qa | null | null | null | null | null | Question:
Is there a reason that only the legs were made outside the function??
Code:
from cs1graphics import *
from time import sleep
import random
def draw_animal():
# Implement this function.
canvas.setBackgroundColor('white')
body=Polygon(Point(170,200),Point(130,200),Point(120,270),Point(180,2... |
5 | 0 | TA | Please explain how you used the global variable in task 1! | balance = 0
def deposit(money) :
# Input : (Integer) The amount of money that a user wants to deposit
# Output : (None) No Output
global balance
# Add the money to the current balance
balance = balance + int(money)
print("You deposited "+ str(money) + " won")
#################
def withdraw... | 2 | 5 | variable | Since the functions used in this task are to add, subtract, or check a value from the global variable balance, he said that each function would use the global variable balance. | cs1qa | null | null | null | null | null | Question:
Please explain how you used the global variable 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
global balance
# Add the money to the current balance
balance = balance + int(money)
pr... |
1 | 4 | TA | Can you briefly explain the function of each function? | from cs1robots import*
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace('blue')
def harvest():
hubo.move()
hubo.pick_beeper()
def turn_right():
for i in range(3):
hubo.turn_left()
def back():
for i in range(2):
hubo.turn_left()
def harvest_right_up():
hubo.move()
turn_right()
harvest()... | 18 | 40 | variable | First, after moving to the bottom point, each function is defined. They are functions that pick beeper while going to the top right, bottom right, top left, and bottom left according to the moving direction. | cs1qa | null | null | null | null | null | Question:
Can you briefly explain the function of each function?
Code:
from cs1robots import*
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace('blue')
def harvest():
hubo.move()
hubo.pick_beeper()
def turn_right():
for i in range(3):
hubo.turn_left()
def back():
for i in range(2):
hubo.... |
10 | 0 | TA | How did you implement the interaction | from cs1graphics import *
from time import sleep
_scene = None
_world = None
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")
_world.d... | 98 | 110 | code_explain | q is the shutdown command, b is the blink method of the ship class, and w is the move method of the ship class.
The command is input with the getKey() method. | cs1qa | null | null | null | null | null | Question:
How did you implement the interaction
Code:
from cs1graphics import *
from time import sleep
_scene = None
_world = None
def create_world():
global _scene, _world
if _scene:
raise RuntimeError("A world already exists!")
_world = _World(500, 300)
_scene = Canvas(_world.width, _worl... |
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... |
4 | 0 | TA | Briefly explain what algorithm you wrote in Task 1! | from cs1robots import *
import time
load_world('worlds/add34.wld')
hubo = Robot()
#Defining functions
def turn_right():
for i in range(3):
hubo.turn_left()
def turn_around():
for i in range(2):
hubo.turn_left()
def Sum(a, b):
return a+b
#Main algorithm
number_of_beeper = 0
Numb... | 20 | 77 | code_explain | Pick up the beepers in row1 and row2, store the number represented by each row in Number_in_row1 and Number_in_row2, respectively, proceed with addition, and display the corresponding result as beeper in row1. | cs1qa | null | null | null | null | null | Question:
Briefly explain what algorithm you wrote in Task 1!
Code:
from cs1robots import *
import time
load_world('worlds/add34.wld')
hubo = Robot()
#Defining functions
def turn_right():
for i in range(3):
hubo.turn_left()
def turn_around():
for i in range(2):
hubo.turn_left()
d... |
2 | 0 | TA | Please briefly explain how to pick up the beeper in step 1 along with the function name! | from cs1robots import *
load_world("worlds/harvest3.wld")
hubo = Robot()
hubo.set_trace('blue')
hubo.move()
def turn_right():
for i in range(3):
hubo.turn_left()
def goStraight():
for i in range(5):
if hubo.on_beeper():
hubo.pick_beeper()
hubo.move()
def turnAroundLeft():... | 11 | 33 | code_explain | First, in the straight section, the goStraight() function was used to pick up the beeper, and turnAroundRight() and turnAroundLeft() were used when turning to the right and turning to the left, respectively. | cs1qa | null | null | null | null | null | Question:
Please briefly explain how to pick up the beeper in step 1 along with the function name!
Code:
from cs1robots import *
load_world("worlds/harvest3.wld")
hubo = Robot()
hubo.set_trace('blue')
hubo.move()
def turn_right():
for i in range(3):
hubo.turn_left()
def goStraight():
for i in rang... |
1 | 3 | TA | Why is the condition checked??? | from cs1robots import *
class Superbot(Robot):
def turn_right(self):
for _ in range(3):
self.turn_left()
def turn_around(self):
for _ in range(2):
self.turn_left()
load_world("worlds/harvest1.wld")
hubo=Superbot()
while True:
if hubo.on_beeper():
... | 19 | 26 | reasoning | Since the x value does not change even after the robot rotates, the direction is also checked. | cs1qa | null | null | null | null | null | Question:
Why is the condition checked???
Code:
from cs1robots import *
class Superbot(Robot):
def turn_right(self):
for _ in range(3):
self.turn_left()
def turn_around(self):
for _ in range(2):
self.turn_left()
load_world("worlds/harvest1.wld")
hubo=Su... |
6 | 0 | TA | Okay, please explain why you used pop() at the end! | def fibonacci(upper_bound):
pass
A=[0,1]
C = True
while A[-1] < upper_bound:
a= A[-1]+A[-2]
A.append(a)
A.pop()
return A
print(fibonacci(1000))
| 0 | 8 | reasoning | Because while was used, a value of True is obtained from the while statement in the last term before the upper bound, and one term above the upper bound is additionally calculated, so the last value is removed through pop(). | cs1qa | null | null | null | null | null | Question:
Okay, please explain why you used pop() at the end!
Code:
def fibonacci(upper_bound):
pass
A=[0,1]
C = True
while A[-1] < upper_bound:
a= A[-1]+A[-2]
A.append(a)
A.pop()
return A
print(fibonacci(1000))
|
5 | 0 | TA | How did you use the global variable 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
#################
### implement ###
#################
# Do something on here
global balance
balance+=mon... | 0 | 32 | variable | The reason balance is used as a global variable is for easy access within both functions. | cs1qa | null | null | null | null | null | Question:
How did you use the global variable 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
#################
### implement ###
##############... |
2 | 2 | TA | Could you please tell me why I set the conditions this way? | from cs1robots import *
load_world('worlds/hurdles3.wld')
hubo= Robot(beepers=100)
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def jump_one_hurdle():
hubo.turn_left()
hubo.move()
turn_right()
hubo.move()
turn_right()
... | 10 | 22 | reasoning | The second task condition told me to stop if you step on the beeper.
If you step on the beeper, the conditions below will not work.
Before stepping on the beeper, the lower door will run and move over the hurdles | cs1qa | null | null | null | null | null | Question:
Could you please tell me why I set the conditions this way?
Code:
from cs1robots import *
load_world('worlds/hurdles3.wld')
hubo= Robot(beepers=100)
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def jump_one_hurdle():
hubo.turn_left()
hu... |
2 | 0 | TA | Can you explain the right_up_move() function? | import cs1robots as rob
rob.load_world('worlds/harvest3.wld')
hubo=rob.Robot()
hubo.set_trace('blue')
def harv_move():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
def right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
def right_up_move():
for i in range(5):
... | 17 | 22 | variable | right up move
The robot turned to the right and made it a function that goes up one line. | cs1qa | null | null | null | null | null | Question:
Can you explain the right_up_move() function?
Code:
import cs1robots as rob
rob.load_world('worlds/harvest3.wld')
hubo=rob.Robot()
hubo.set_trace('blue')
def harv_move():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
def right():
hubo.turn_left()
hubo.turn_left()
hubo... |
9 | 0 | TA | Please explain the attributes added to the Card class in Task 1. | 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 = []
class Card:
pass
d... | 21 | 29 | variable | .image is used when printing an image file, and .name is used when comparing the two cards to see if they are the same as the file name. If the state is False, it is used to print the back side, and if the state is False, the front side is printed. | cs1qa | null | null | null | null | null | Question:
Please explain the attributes added to the Card class in Task 1.
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")
ca... |
2 | 3 | TA | Yes, then 4 is similar to most 1, but please explain why you used while instead of if | from cs1robots import *
load_world('worlds/harvest1.wld')
hubo = Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def go_straight():
for i in range(5):
while hubo.on_beeper():
hubo.pick_beeper()
hubo.move()
def left_move():
... | 10 | 52 | reasoning | If is executed only once, but continues to execute if the condition is met, so if there were multiple beepers, while could be used to get them all. | cs1qa | null | null | null | null | null | Question:
Yes, then 4 is similar to most 1, but please explain why you used while instead of if
Code:
from cs1robots import *
load_world('worlds/harvest1.wld')
hubo = Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def go_straight():
for i in range(5):
... |
2 | 2 | TA | Please explain each function in Task3 Hurdle | 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.wl... | 14 | 33 | variable | I made a function that rotates to the right, and after making more than one hurdle, when it reaches the beeper, it stops and picks up the beeper. | cs1qa | null | null | null | null | null | Question:
Please explain each function in Task3 Hurdle
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('worlds/hurdles1.wld')
#... |
9 | 1 | TA | Please briefly explain how your 5 functions work! | import random
from cs1graphics import *
img_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 Jac... | 28 | 44 | variable | The create_deck function is a function that shuffles after entering information about the card information (pattern, number, value) for each 52 cards. | cs1qa | null | null | null | null | null | Question:
Please briefly explain how your 5 functions work!
Code:
import random
from cs1graphics import *
img_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... |
6 | 0 | TA | Task 1 I'll give you a brief explanation! | def fibonacci(upper_bound):
numbers=[0, 1]
n = 0
m = 0
while True:
n = numbers[m] + numbers[m+1]
if n > upper_bound:
break
numbers.append(n)
m = m+1
return numbers
pass
print(fibonacci(1000))
| 4 | 9 | code_explain | task1 uses the definition of the Fibonacci sequence as it is, and is configured to repeat the expression until the value of the sequence is greater than the upper bound. | cs1qa | null | null | null | null | null | Question:
Task 1 I'll give you a brief explanation!
Code:
def fibonacci(upper_bound):
numbers=[0, 1]
n = 0
m = 0
while True:
n = numbers[m] + numbers[m+1]
if n > upper_bound:
break
numbers.append(n)
m = m+1
return numbers
pass
print(fibonacci(1000)... |
6 | 2 | TA | What are the conditions for showing the card? | 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... | 113 | 116 | code_explain | In is valid, I checked whether the range of integer numbers is correct, whether the two numbers are different, etc., and by checking in the check function, I checked whether the name in the temp tuple of the card is the same. | cs1qa | null | null | null | null | null | Question:
What are the conditions for showing the card?
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 =... |
6 | 2 | student | Why does! | 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... | 93 | 93 | code_understanding | Because the while statement has to run until correct_list does not contain all the numbers
I made it not equal | cs1qa | null | null | null | null | null | Question:
Why does!
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 = []
tries = 1
correct_list = []
de... |
2 | 0 | TA | Can you explain the right_up_move() function? | import cs1robots as rob
rob.load_world('worlds/harvest3.wld')
hubo=rob.Robot()
hubo.set_trace('blue')
def harv_move():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
def right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
def right_up_move():
for i in range(5):
... | 17 | 22 | variable | right up move
The robot turned to the right and made it a function that goes up one line. | cs1qa | null | null | null | null | null | Question:
Can you explain the right_up_move() function?
Code:
import cs1robots as rob
rob.load_world('worlds/harvest3.wld')
hubo=rob.Robot()
hubo.set_trace('blue')
def harv_move():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
def right():
hubo.turn_left()
hubo.turn_left()
hubo... |
3 | 2 | TA | What is the meaning of the turn variable used here? | 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("red")
# hubo.set_pause(1)
turn = 0
def turn_right():
for i in range(3):
hubo.turn_left()
def move():
while hubo.f... | 22 | 47 | variable | When the turn is even number, it turns to the right, and when the turn is odd number, it turns to the left. | cs1qa | null | null | null | null | null | Question:
What is the meaning of the turn variable used here?
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("red")
# hubo.set_pause(1)
turn = 0
def turn_right():
for i in r... |
6 | 2 | TA | What do you do in the initialize function | 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():
global ca... | 16 | 36 | variable | I just added `random.shuffle(cards)` to shuffle the order of cards as what must be done. | cs1qa | null | null | null | null | null | Question:
What do you do in the initialize function
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 = []
... |
9 | 1 | TA | In the second task, when the dealer's state is false, it checks, but why not check the player? | import random
from cs1graphics import *
img_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 Jac... | 126 | 130 | reasoning | This is because the value of the state attribute will not be False for all cards the player has. | cs1qa | null | null | null | null | null | Question:
In the second task, when the dealer's state is false, it checks, but why not check the player?
Code:
import random
from cs1graphics import *
img_path = './images/'
suit_names = ['Clubs', 'Diamonds', 'Hearts', 'Spades']
face_names = ['Ace', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', ... |
4 | 0 | TA | How did you implement the addition in step 1? | import cs1robots
def main():
cs1robots.load_world("worlds/add34.wld")
hubo = cs1robots.Robot(beepers=100)
def turn_right():
for _ in range(3):
hubo.turn_left()
return None
def back():
for _ in range(2):
hubo.turn_left()
return None
d... | 48 | 60 | code_explain | First, we searched for the numbers in the same line through the read() function and found how many numbers were written in this line.
I wrote a code that read() for line 1 and line 2, and then writes the sum of the two numbers in line 1 through write() | cs1qa | null | null | null | null | null | Question:
How did you implement the addition in step 1?
Code:
import cs1robots
def main():
cs1robots.load_world("worlds/add34.wld")
hubo = cs1robots.Robot(beepers=100)
def turn_right():
for _ in range(3):
hubo.turn_left()
return None
def back():
for _ in rang... |
4 | 0 | TA | How do you get the number of beepers when writing? | import cs1robots
def main():
cs1robots.load_world("worlds/add34.wld")
hubo = cs1robots.Robot(beepers=100)
def turn_right():
for _ in range(3):
hubo.turn_left()
return None
def back():
for _ in range(2):
hubo.turn_left()
return None
d... | 39 | 46 | code_explain | First, we moved the robot to the last column, then flipped the direction and moved forward, dividing the remainder of the number currently remaining in each column divided by 10, and then the remaining number divided by 10. | cs1qa | null | null | null | null | null | Question:
How do you get the number of beepers when writing?
Code:
import cs1robots
def main():
cs1robots.load_world("worlds/add34.wld")
hubo = cs1robots.Robot(beepers=100)
def turn_right():
for _ in range(3):
hubo.turn_left()
return None
def back():
for _ in... |
5 | 0 | TA | What does bank() in task1 line 53 do? | balance = 0
def deposit(money) :
# Input : (Integer) The amount of money that a user wants to deposit
# Output : (None) No Output
global balance
# Add the money to the current balance
balance+= money
print('You deposited '+ str(money) +' won')
#################
### implement ###
##... | 52 | 52 | variable | It plays the role of executing the function again after typing the word to enter the correct value | cs1qa | null | null | null | null | null | Question:
What does bank() in task1 line 53 do?
Code:
balance = 0
def deposit(money) :
# Input : (Integer) The amount of money that a user wants to deposit
# Output : (None) No Output
global balance
# Add the money to the current balance
balance+= money
print('You deposited '+ str(money) +'... |
1 | 2 | TA | Could you briefly explain what the one_cycle function of tasks 3 and 4 does? | from cs1robots import *
load_world('worlds/newspaper.wld')
hubo=Robot(beepers = 1)
hubo.set_trace("blue")
def turn_right() :
for i in range(3) :
hubo.turn_left()
def turn_around() :
for i in range(2) :
hubo.turn_left()
def one_cycle ():
hubo.move()
hubo.turn_left()
hubo.move()
tu... | 10 | 15 | variable | In task 4, it goes back and forth in the letter ㄹ, but once in the form of c is one cycle | cs1qa | null | null | null | null | null | Question:
Could you briefly explain what the one_cycle function of tasks 3 and 4 does?
Code:
from cs1robots import *
load_world('worlds/newspaper.wld')
hubo=Robot(beepers = 1)
hubo.set_trace("blue")
def turn_right() :
for i in range(3) :
hubo.turn_left()
def turn_around() :
for i in range(2) :
... |
8 | 1 | TA | For what reason did you put 5, 21, and 22 in task2? | name=[]
location=[]
f=open("average-latitude-longitude-countries.csv","r")
lines=f.readlines()
lines.pop(0)
for line in lines:
line=line.rstrip()
line=line.split(",")
if len(line)!=4:
line[1]=line[1]+','+line[2]
line.pop(2)
line[0]=line[0].replace('"','')
line[1]=line[1].replace('"',... | 4 | 21 | reasoning | I removed the first line from 5, and it seems that there was a mistake in the correction process for 21 and 22 | cs1qa | null | null | null | null | null | Question:
For what reason did you put 5, 21, and 22 in task2?
Code:
name=[]
location=[]
f=open("average-latitude-longitude-countries.csv","r")
lines=f.readlines()
lines.pop(0)
for line in lines:
line=line.rstrip()
line=line.split(",")
if len(line)!=4:
line[1]=line[1]+','+line[2]
line.pop(... |
2 | 4 | TA | How is number used in this task? | from cs1robots import *
# Your code must work for empty worlds of all possible sizes.
create_world(avenues=10, streets=10)
#create_world(avenues=11, streets=8)
#create_world(avenues=6, streets=9)
#create_world(avenues=1, streets=3)
#create_world(avenues=2, streets=1)
#create_world(avenues=1, streets=2)
# ...
my_robo... | 22 | 42 | variable | When the number is odd, the robot is moving upward, and when the number is even, the robot is moving downward. | cs1qa | null | null | null | null | null | Question:
How is number used in this task?
Code:
from cs1robots import *
# Your code must work for empty worlds of all possible sizes.
create_world(avenues=10, streets=10)
#create_world(avenues=11, streets=8)
#create_world(avenues=6, streets=9)
#create_world(avenues=1, streets=3)
#create_world(avenues=2, streets=1... |
9 | 0 | TA | What are number and number_back functions? | # Copy your "Memento" code from the task in Lab 6.
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 = []
tries = 1
def suffle()... | 73 | 79 | variable | task1 number function is a function that selects a number or a picture to be displayed on the screen by making the number above the picture and the back function making the picture above the number. | cs1qa | null | null | null | null | null | Question:
What are number and number_back functions?
Code:
# Copy your "Memento" code from the task in Lab 6.
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", "Sa... |
6 | 1 | TA | Please explain number 2 for each function | 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]
"""
li=[]
for i in range(tria... | 18 | 30 | variable | average_integers() adds each term to the list created above and divides it by the length of the list to find the average. | cs1qa | null | null | null | null | null | Question:
Please explain number 2 for each function
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 list. ... |
8 | 0 | TA | How did you create the Task1 merge() function? | from time import sleep
import elice_utils
def merge(input_filenames, output_filename):
# Implement here
a = open(input_filenames[0],"r")
a1=a.read()
b = open(input_filenames[1],"r")
b1=b.read()
c = open(input_filenames[2],"r")
c1=c.read()
d = open(output_filename, "w")
d.write(a1+"\... | 3 | 14 | code_explain | The merge function of task 1 was written by reading the contents of each input file and appending the contents to the output file. | cs1qa | null | null | null | null | null | Question:
How did you create the Task1 merge() function?
Code:
from time import sleep
import elice_utils
def merge(input_filenames, output_filename):
# Implement here
a = open(input_filenames[0],"r")
a1=a.read()
b = open(input_filenames[1],"r")
b1=b.read()
c = open(input_filenames[2],"r")
... |
5 | 0 | TA | How did you use the balance variable 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
global balance
balance+=money
def withdrawal(money) :
# Input : (Integer) The amount of money that a user wants to... | 0 | 18 | variable | Since the balance variable is a global variable, the value is changed by using the global function in the function. | cs1qa | null | null | null | null | null | Question:
How did you use the balance variable 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
global balance
balance+=money
def withdrawal(money) ... |
2 | 2 | TA | What is the role of task3's while statement? | 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.... | 23 | 27 | code_explain | If the condition after while is satisfied, the following children are continuously executed. Task3 has to be executed before meeting the beeper, so I added not to the while to perform the function until the beeper is met. | cs1qa | null | null | null | null | null | Question:
What is the role of task3's while statement?
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('worlds/hurdles1.wld')
# ... |
6 | 0 | TA | Please explain what you are doing inside the while statement! | def fibonacci(upper_bound):
list = [0, 1]
while (list[-1] + list[-2]) < upper_bound:
list.append(list[-1]+list[-2])
return list
print(fibonacci(1000))
| 2 | 3 | code_explain | Add the last two terms of the list with Fibonacci numbers, and if less than the upper bound, add the sum of the two numbers to the list. | cs1qa | null | null | null | null | null | Question:
Please explain what you are doing inside the while statement!
Code:
def fibonacci(upper_bound):
list = [0, 1]
while (list[-1] + list[-2]) < upper_bound:
list.append(list[-1]+list[-2])
return list
print(fibonacci(1000))
|
1 | 4 | TA | Seeing that you created the harvest() function and called it several times at the end of the code, is there any reason you didn't use the for statement here? | from cs1robots import *
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def move_next_beeper():
hubo.move()
turn_right()
hubo.move()
hubo.turn_left()
def harvest_one():
hubo.pick_beeper()
move_next_beeper()... | 15 | 30 | reasoning | When I used the for statement, I couldn't use it because I didn't know how to change the number in (). | cs1qa | null | null | null | null | null | Question:
Seeing that you created the harvest() function and called it several times at the end of the code, is there any reason you didn't use the for statement here?
Code:
from cs1robots import *
load_world('worlds/harvest2.wld')
hubo = Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
... |
2 | 0 | TA | What is set2 function in task1? | from cs1robots import *
load_world('worlds/harvest3.wld')
hubo = Robot()
hubo.set_trace('blue')
def move_and_pick():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
def set1():
if hubo.on_beeper():
... | 23 | 29 | variable | I created a function for two lines by combining two set1 functions that define the movement of a robot and a direction change function. | cs1qa | null | null | null | null | null | Question:
What is set2 function in task1?
Code:
from cs1robots import *
load_world('worlds/harvest3.wld')
hubo = Robot()
hubo.set_trace('blue')
def move_and_pick():
hubo.move()
if hubo.on_beeper():
hubo.pick_beeper()
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn... |
2 | 0 | TA | What does Task 1's move_pick function do? | from cs1robots import*
load_world("worlds/harvest3.wld")
hubo = Robot()
hubo.set_trace('blue')
hubo.move()
def turn_right():
for i in range(3):
hubo.turn_left()
def move_pick():
if hubo.on_beeper():
hubo.pick_beeper()
hubo.move()
else:
hubo.move()
def zig_zag():
for ... | 8 | 13 | variable | Where there is no beeper, it just goes away, and where there is a beeper, it picks up the beeper. | cs1qa | null | null | null | null | null | Question:
What does Task 1's move_pick function do?
Code:
from cs1robots import*
load_world("worlds/harvest3.wld")
hubo = Robot()
hubo.set_trace('blue')
hubo.move()
def turn_right():
for i in range(3):
hubo.turn_left()
def move_pick():
if hubo.on_beeper():
hubo.pick_beeper()
hubo... |
4 | 2 | TA | What are the termination conditions? | 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... | 181 | 183 | code_explain | The end condition is when the length of the list of correct answers is 24. | cs1qa | null | null | null | null | null | Question:
What are the termination conditions?
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 = []
tries... |
9 | 0 | TA | What are number and number_back functions? | # Copy your "Memento" code from the task in Lab 6.
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 = []
tries = 1
def suffle()... | 73 | 77 | variable | task1 number function is a function that selects a number or a picture to be displayed on the screen by making the number above the picture and the back function making the picture above the number. | cs1qa | null | null | null | null | null | Question:
What are number and number_back functions?
Code:
# Copy your "Memento" code from the task in Lab 6.
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", "Sa... |
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))
| 5 | 5 | 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))
|
1 | 4 | TA | Can you explain what task 5's t2 function does and how it was used? | from cs1robots import *
load_world('worlds/harvest2.wld')
hubo=Robot(beepers=1)
hubo.set_trace('blue')
def har():
for i in range(2):
hubo.move()
hubo.pick_beeper()
def t1(x):
hubo.move()
for i in range(x):
hubo.turn_left()
hubo.move()
hubo.pick_beeper()
for i in range(x):
... | 16 | 50 | variable | t2 is used when the robot passes through the right side
(These are the functions used when the robot moves a straight path and then makes a turn) | cs1qa | null | null | null | null | null | Question:
Can you explain what task 5's t2 function does and how it was used?
Code:
from cs1robots import *
load_world('worlds/harvest2.wld')
hubo=Robot(beepers=1)
hubo.set_trace('blue')
def har():
for i in range(2):
hubo.move()
hubo.pick_beeper()
def t1(x):
hubo.move()
for i in range(x):
... |
6 | 2 | student | On top of return False in the check of the original code
With print_cards()
Does it mean to share the printouts in some cases? | from cs1graphics import *
import time
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():
# initialize cards
... | 76 | 93 | code_understanding | Yes, it seems like that, when it was wrong and when it was correct
Because I have to show a different screen
According to the conditions of showing photos in `print_cards`
Separate cases appropriately and call `print_cards` for each. | cs1qa | null | null | null | null | null | Question:
On top of return False in the check of the original code
With print_cards()
Does it mean to share the printouts in some cases?
Code:
from cs1graphics import *
import time
canvas = Canvas(640, 580)
canvas.setTitle("Memento")
path = "./images/"
names = ("Dohoo.jpg", "Jeongmin.jpg", "Jinyeong.jpg",
... |
1 | 0 | TA | if i<4:
hubo.turn_left()
hubo.move()
Could you please explain why you added this part? | from cs1robots import *
create_world()
hubo = Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def go_straight():
for i in range(9):
hubo.move()
for i in range(5):
hubo.turn_left()
go_straight()
turn_right()
hubo.move()
... | 22 | 24 | reasoning | If i=4, there is no more space left on the right, so I tried to stop the code | cs1qa | null | null | null | null | null | Question:
if i<4:
hubo.turn_left()
hubo.move()
Could you please explain why you added this part?
Code:
from cs1robots import *
create_world()
hubo = Robot()
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def go_straight():
for i in range(9):
... |
1 | 0 | TA | task 1 Please explain the worm function | from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def worm():
for i in range(9):
hubo.move()
turn_right()
hubo.move()
turn_right()
for i in range(9):
hubo.move()
hubo.turn_left... | 8 | 18 | variable | The worm function is a function that makes it the same as the initial state after going up and down once, going down again, going one space to the right. | cs1qa | null | null | null | null | null | Question:
task 1 Please explain the worm function
Code:
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
def turn_right():
for i in range(3):
hubo.turn_left()
def worm():
for i in range(9):
hubo.move()
turn_right()
hubo.move()
turn_right()
... |
1 | 4 | TA | Why did you define a separate function called pick()? | from cs1robots import *
load_world('worlds/harvest2.wld')
A=Robot()
A.set_trace('blue')
def turn_right() :
A.turn_left()
A.turn_left()
A.turn_left()
def right():
turn_right()
A.move()
turn_right()
A.pick_beeper()
A.move()
def left():
A.turn_left()
A.move()
A.turn_left()
... | 21 | 24 | reasoning | As I was writing the code, I defined that behavior over and over again. | cs1qa | null | null | null | null | null | Question:
Why did you define a separate function called pick()?
Code:
from cs1robots import *
load_world('worlds/harvest2.wld')
A=Robot()
A.set_trace('blue')
def turn_right() :
A.turn_left()
A.turn_left()
A.turn_left()
def right():
turn_right()
A.move()
turn_right()
A.pick_beeper()
... |
5 | 1 | TA | Then in task2
Which two objects operate separately in animation? | from cs1graphics import *
from time import sleep
canvas=Canvas(800,800)
canvas.setBackgroundColor('light blue')
boat=Layer()
row1=Rectangle(10,70,Point(60,0))
row2=Rectangle(10,70,Point(-20,0))
def draw_animal():
# Implement this function.
body=Polygon(Point(-100,-60),Point(140,-60),Point(100,0),Point(-100,0))
... | 28 | 36 | code_explain | The whole boat and the rowing motion when the boat is moving were made to move separately | cs1qa | null | null | null | null | null | Question:
Then in task2
Which two objects operate separately in animation?
Code:
from cs1graphics import *
from time import sleep
canvas=Canvas(800,800)
canvas.setBackgroundColor('light blue')
boat=Layer()
row1=Rectangle(10,70,Point(60,0))
row2=Rectangle(10,70,Point(-20,0))
def draw_animal():
# Implement this fu... |
4 | 3 | TA | Could you briefly explain why you set character_count_per_line to int(sin(x)*40+40) in Task 4? | import math
sin = math.sin
pi = math.pi
for i in range(41):
x = float(i) / 40.0 * 2 * pi
if sin(x)>0:
character_count_per_line = int(sin(x)*40+40)
elif sin(x)<0:
character_count_per_line = int(40+sin(x)*40)
elif sin(x)==0:
character_count_per_line = 40
output_str = '#' * c... | 7 | 12 | reasoning | In the expected result, the maximum number of points is 80 and the minimum number of points is 0.
If the function form is to be sin form
I thought that the sin function was increased by 40 times and moved 40 spaces in the y-axis direction. | cs1qa | null | null | null | null | null | Question:
Could you briefly explain why you set character_count_per_line to int(sin(x)*40+40) in Task 4?
Code:
import math
sin = math.sin
pi = math.pi
for i in range(41):
x = float(i) / 40.0 * 2 * pi
if sin(x)>0:
character_count_per_line = int(sin(x)*40+40)
elif sin(x)<0:
character_coun... |
2 | 4 | TA | Please explain how you checked the termination condition of task5 | from cs1robots import *
# create_world(avenues=10, streets=10)
# create_world(avenues=11, streets=8)
# create_world(avenues=6, streets=9)
# create_world(avenues=1, streets=3)
# create_world(avenues=2, streets=1)
create_world(avenues=1, streets=2)
# ...
my_robot = Robot(beepers=1)
my_robot.set_trace('blue')
my_robot.s... | 36 | 49 | code_explain | Originally, it would be good to solve the bias of avenues and streets, but it was not a form of entering the size, so I decided to use beeper.
First, I thought of running the while statement by looking at go_straight/turn_right_larger/go_straight/turn_left_larger as a repeat unit.
I made the beeper drop if the two func... | cs1qa | null | null | null | null | null | Question:
Please explain how you checked the termination condition of task5
Code:
from cs1robots import *
# create_world(avenues=10, streets=10)
# create_world(avenues=11, streets=8)
# create_world(avenues=6, streets=9)
# create_world(avenues=1, streets=3)
# create_world(avenues=2, streets=1)
create_world(avenues=... |
6 | 2 | TA | What do you do in the initialize function | 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():
global ca... | 16 | 36 | variable | I just added `random.shuffle(cards)` to shuffle the order of cards as what must be done. | cs1qa | null | null | null | null | null | Question:
What do you do in the initialize function
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 | The last thing you did without diagonal_bottom() is because of the conflict? | from cs1robots import*
load_world('worlds/harvest2.wld')
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
for i in range(4):
hubo.move()
def diagonal_top():
for i in range(6):
hubo.move()
hubo.turn_left()
hubo.move()
... | 37 | 45 | reasoning | Yeah | cs1qa | null | null | null | null | null | Question:
The last thing you did without diagonal_bottom() is because of the conflict?
Code:
from cs1robots import*
load_world('worlds/harvest2.wld')
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
for i in range(4):
hubo.move()
def diagonal_to... |
10 | 0 | TA | What is boost() function? | 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 | That's a function where hulk grows by 1.1 times at intervals of t/5.
I repeated it 10 times | cs1qa | null | null | null | null | null | Question:
What is boost() function?
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(_world.width, _world.h... |
3 | 0 | TA | Please explain what you are doing in the left() function! | from cs1robots import *
create_world()
hubo=Robot(orientation='N', avenue=5, street=5)
hubo.set_trace('blue')
def left():
while not hubo.facing_north():
hubo.turn_left()
hubo.turn_left()
left()
while hubo.front_is_clear():
hubo.move()
hubo.turn_left()
while hubo.front_is_clear():
hubo.move... | 5 | 8 | variable | It's a function that makes you look left unconditionally | cs1qa | null | null | null | null | null | Question:
Please explain what you are doing in the left() function!
Code:
from cs1robots import *
create_world()
hubo=Robot(orientation='N', avenue=5, street=5)
hubo.set_trace('blue')
def left():
while not hubo.facing_north():
hubo.turn_left()
hubo.turn_left()
left()
while hubo.front_is_clear()... |
4 | 2 | TA | What is x? | import math
sin = math.sin
pi = math.pi
'''
for i in range(31):
x = float(i) / 30.0 * 2 * pi
print (sin(x))
'''
a = int(input('How many steps? '))
for i in range(a):
x = float(i) / 30.0 * 2 * pi
print (sin(x)) | 14 | 14 | variable | float(i) / 30.0 * 2 * pi | cs1qa | null | null | null | null | null | Question:
What is x?
Code:
import math
sin = math.sin
pi = math.pi
'''
for i in range(31):
x = float(i) / 30.0 * 2 * pi
print (sin(x))
'''
a = int(input('How many steps? '))
for i in range(a):
x = float(i) / 30.0 * 2 * pi
print (sin(x)) |
6 | 2 | TA | Where is the first part of initializing cards, and what is the type of each element in the 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 = 0
correct_list = []
def initialize():
# initial... | 16 | 34 | variable | It seems that the first time cards are initialized in the initialize function, and the elements in cards are tuples. | cs1qa | null | null | null | null | null | Question:
Where is the first part of initializing cards, and what is the type of each element in the 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"... |
9 | 0 | student | so is the attribute a boolean? | # Copy your "Memento" code from the task in Lab 6.
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
... | 18 | 21 | code_understanding | That differs by your coding
can be a boolean | cs1qa | null | null | null | null | null | Question:
so is the attribute a boolean?
Code:
# Copy your "Memento" code from the task in Lab 6.
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", ... |
6 | 0 | TA | Please explain what upper_bound does in Task 1 | def fibonacci(upper_bound):
result = [0, 1]
index = 2
while True :
if result[index - 2] + result[index - 1] < upper_bound :
result.append(result[index - 2] + result[index - 1])
else :
break
index += 1
return result
print(fibonacci(1000))
| 4 | 7 | variable | Set the termination condition of the while loop | cs1qa | null | null | null | null | null | Question:
Please explain what upper_bound does in Task 1
Code:
def fibonacci(upper_bound):
result = [0, 1]
index = 2
while True :
if result[index - 2] + result[index - 1] < upper_bound :
result.append(result[index - 2] + result[index - 1])
else :
break
inde... |
1 | 3 | TA | Could you please explain why 8-10 is so tight? | # 6 5 5 4 4 3 3 2 2 1 1
from cs1robots import *
load_world('worlds/harvest1.wld')
hubo = Robot()
hubo.set_trace('blue')
for i in range(11):
l = int(6-(i)/2)
for _ in range(l):
hubo.move()
hubo.pick_beeper()
hubo.turn_left() | 7 | 12 | reasoning | For convenience, I wanted to minimize the number of turns, so I made it move in a snail shape.
When the length (number of movements) for one side was generalized, it was floor(6-i/2) so I wrote it like that | cs1qa | null | null | null | null | null | Question:
Could you please explain why 8-10 is so tight?
Code:
# 6 5 5 4 4 3 3 2 2 1 1
from cs1robots import *
load_world('worlds/harvest1.wld')
hubo = Robot()
hubo.set_trace('blue')
for i in range(11):
l = int(6-(i)/2)
for _ in range(l):
hubo.move()
hubo.pick_beeper()
hubo.turn_left() |
8 | 2 | TA | line 27 in task3
output.write(',')
Why do I need it? | import elice_utils
f=open("tpmon.txt","r")
data=[]
data2=[]
counts=0
for line in f:
data.append(line.strip())
count1=0
for i in range(1,len(data)):
data2.append(1722+i)
temp=data[i].split(" ")
temp2=[]
for i in range(len(temp)):
if temp[i]!='':
data2.append(float(temp[i]))
p... | 26 | 26 | reasoning | In the problem, I asked for, in the output file, but since there is no, in the list, I put it. | cs1qa | null | null | null | null | null | Question:
line 27 in task3
output.write(',')
Why do I need it?
Code:
import elice_utils
f=open("tpmon.txt","r")
data=[]
data2=[]
counts=0
for line in f:
data.append(line.strip())
count1=0
for i in range(1,len(data)):
data2.append(1722+i)
temp=data[i].split(" ")
temp2=[]
for i in range(len(te... |
5 | 1 | TA | Please explain how you squeezed it! | from cs1graphics import *
from time import sleep
def draw_animal():
# Implement this function.
global tail
global canvas
global pig
global legL
global legR
canvas=Canvas(800,600)
canvas.setBackgroundColor("light blue")
ground=Rectangle(800,110,Point(400,540))
ground.se... | 0 | 126 | code_explain | In Task 2, the pig's tail and the left leg and the right leg are placed as a layer and move separately, and the entire pig's body is also placed in one layer, and the code is made to move.
In the case of the tail and the legs, repeat the rotation by a certain angle in a clockwise counterclockwise direction according to... | cs1qa | null | null | null | null | null | Question:
Please explain how you squeezed it!
Code:
from cs1graphics import *
from time import sleep
def draw_animal():
# Implement this function.
global tail
global canvas
global pig
global legL
global legR
canvas=Canvas(800,600)
canvas.setBackgroundColor("light blue")
... |
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))
| 0 | 6 | 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))
|
8 | 1 | TA | Why is there an input("press again") in that animation? | from cs1graphics import *
from time import sleep
canvas = Canvas(800, 600)
canvas.setBackgroundColor("light blue")
canvas.setTitle("Zoo")
ground = Rectangle(800, 250, Point(400, 475))
ground.setFillColor((0, 255, 0))
ground.setDepth(100)
ground.setBorderWidth(5)
ground.setBorderColor((0, 255, 0))
canvas.add(ground)
e... | 154 | 154 | reasoning | I will fix it | cs1qa | null | null | null | null | null | Question:
Why is there an input("press again") in that animation?
Code:
from cs1graphics import *
from time import sleep
canvas = Canvas(800, 600)
canvas.setBackgroundColor("light blue")
canvas.setTitle("Zoo")
ground = Rectangle(800, 250, Point(400, 475))
ground.setFillColor((0, 255, 0))
ground.setDepth(100)
ground... |
1 | 3 | TA | Can you explain pick_beeper_oneline() and next_line_left_pick_beepers_oneline() in task4? | from cs1robots import*
load_world('worlds/harvest1.wld')
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
def pick_beeper_move():
hubo.pick_beeper()
hubo.move()
def pick_beeper_oneline():
for i in range(5):
pick_beeper_m... | 15 | 24 | variable | pick_beeper_oneline() picks up all the beepers horizontally, and next_line_left_pick_beepers_oneline() turns left and goes up to the next line. | cs1qa | null | null | null | null | null | Question:
Can you explain pick_beeper_oneline() and next_line_left_pick_beepers_oneline() in task4?
Code:
from cs1robots import*
load_world('worlds/harvest1.wld')
hubo=Robot()
hubo.set_trace('blue')
def turn_right():
hubo.turn_left()
hubo.turn_left()
hubo.turn_left()
def pick_beeper_move():
hu... |
5 | 0 | TA | Task 1. Please explain the role of the Withdrawal function. | 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 ###
#################
plus=int(input('How much you want to deposit'))
print(... | 17 | 35 | variable | The withdrawal function receives the desired amount of deposit and compares it with the money in the bankbook, and prints a message stating that the amount of money remaining in the bankbook is larger and less, and the deposit is not made. | cs1qa | null | null | null | null | null | Question:
Task 1. Please explain the role of the Withdrawal function.
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 ###
#... |
6 | 0 | TA | Please explain what upper_bound does in Task 1 | def fibonacci(upper_bound):
lista = [0, 1]
a=0
b=0
while 1==1:
b = lista[a] + lista[a+1]
if (b < upper_bound):
lista.append(b)
else:
break
a=a+1
print(lista)
pass
print(fibonacci(1000))
| 0 | 11 | variable | upper_bound refers to the upper limit of the Fibonacci number, and when the Fibonacci number in the code is larger than this, the loop is escaped. | cs1qa | null | null | null | null | null | Question:
Please explain what upper_bound does in Task 1
Code:
def fibonacci(upper_bound):
lista = [0, 1]
a=0
b=0
while 1==1:
b = lista[a] + lista[a+1]
if (b < upper_bound):
lista.append(b)
else:
break
a=a+1
print(lista)
pass
print(fibo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.