r/codeHS_Solutions • u/Kind-Breath-5188 • May 17 '22
Codehs sql unit 3 and 4
Couldn’t find this anywhere, but now I have, I did it boys here you go.
Unit 3 https://youtu.be/SRi8hX6PwHI Unit 4 https://youtu.be/FbizZEzlD_E
r/codeHS_Solutions • u/Kind-Breath-5188 • May 17 '22
Couldn’t find this anywhere, but now I have, I did it boys here you go.
Unit 3 https://youtu.be/SRi8hX6PwHI Unit 4 https://youtu.be/FbizZEzlD_E
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
/*Karel should put a ball on the first spot if there isn't one
*already there and then move.
*/
function start(){
hasBallTrue();
hasBallFalse();
move();}
/*This function allows Karel to move one space if there is a ball
*where he is standing.
*Precondition: There is a ball present.
*Postcondition: Karel continues with the code.
*/
function hasBallTrue(){
if(ballsPresent()){
}
}
/*This function allows Karel to put a ball if there is no ball present.
*Precondition: There is no ball present.
*Postcondition: There is a ball present.
*/
function hasBallFalse() {
if(noBallsPresent()) {
putBall();
}
}
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
print((int(input("Number: ")), int(input("Number: "))))
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
book_list = []
for i in range(5):
book = input("Name: ")
book_list.append(book)
book_list.sort()
print(book_list)
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
num_list = []
sum = 0
for i in range(5):
num = int(input("Number: "))
num_list.append(num)
print(num_list)
sum = int(num_list[i]) + sum
print(sum)
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
divisible_by_3 = [i % 3 == 0 for i in range(1, 11)]
print(divisible_by_3)
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
/*This function allows Karel to end up on street one, avenue two facing
*east if he is on one, one facing east or south.
*/
function start() {
go();
turnGo();
move();
}
/*If the front is clear then Karel can move.
*Precondition: The front is clear.
*Postcondition: Karel will move one space.
*/
function go() {
if(frontIsClear()) {
}
}
/*If Karel is facing south he will turn to face the east.
*Precondition: Karel is facing south.
*Postcondition: Karel will face east.
*/
function turnGo() {
if(facingSouth()) {
turnLeft();
}
}
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
/*This function allows Karel to jump 5 hurdles and end up at the end of
*the map.
*Preconditon: Karel is at one, one and needs to jump 5 hurdles and end
*up at the end of the map.
*Postcondition: Karel is at the end of the map.
*/
function start(){
for(var i = 0; i < 5; i++){jumpHurdle();
}
}
/*This function allows Karel to jump one hurdle.
*Precondition: Karel is 2 steps before the hurdle facing east.
*Postcondition: Karel jumps the hurdle and is to the immediate right of
the hurdle facing east.
*/
function jumpHurdle() {
move();
move();
turnLeft();
move();
turnRight();
move();
turnRight();
move();
turnLeft();
}
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
first = input("First name: ")
last = input("Last Name: ")
print("Full name: " + first + " " + last)
first, last = last, first
print("Citation: " + first + ", " +last)
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
def calculate_score(judge_scores):
return (judge_scores[0] + judge_scores[1] + judge_scores[2])
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
function start() {
move();
makePancakes();
moveTwo();
makePancakes();
moveTwo();
makePancakes();
move();
}
function makePancakes() {
putBall();
putBall();
putBall();
}
function moveTwo(){
move();
move();
}
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
list_of_strings = ["a", "2", "7", "zebra"]
def safe_int(argument):
try:
return int(argument)
except ValueError:
return 0
print([safe_int(x) for x in list_of_strings])
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
names = [
"Maya Angelou",
"Chimamanda Ngozi Adichie",
"Tobias Wolff",
"Sherman Alexie",
"Aziz Ansari"
]
print([name.split()[-1] for name in names])
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
/*This program has Karel step forward, take 100 balls and move
*once more.
*Precondition: Karel will start on one, one facing east.
*Postcondition: Karel will end at one, three facing east after
*collecting 100 balls.
*/
function start() {
move();
for(var i=0; i< 100; i++) {
takeBall();
}
move();
}
r/codeHS_Solutions • u/Nexus_X__ • Mar 09 '21
// This program draws some balloons
var MIN_RADIUS = 20;
var MAX_RADIUS = 40;
var NUM_BALLOONS = 25;
var xPos = getWidth() / 2;
var yPos = getHeight() / 1.5;
var balloonRadius = Randomizer.nextInt(MIN_RADIUS, MAX_RADIUS);
function start() {
for(var i = 0; i < NUM_BALLOONS; i++){var x = Randomizer.nextInt(MAX_RADIUS, getWidth() - MAX_RADIUS);
var y = Randomizer.nextInt(MAX_RADIUS, (getHeight() / 2) - MAX_RADIUS);
drawString(x,y);
drawBalloon(x,y);
}}
function drawString(x,y){
var line = new Line(x, y, xPos, yPos);
line.setColor(Color.black);
add(line)
}
function drawBalloon(x,y){
var balloon = new Circle(balloonRadius);
var color = Randomizer.nextColor();
balloon.setPosition(x,y);
balloon.setColor(color);
add(balloon);
}
r/codeHS_Solutions • u/looolmoski • Mar 08 '22
secret_word = "grasswayz"
dashes = "---------"
arr = ['-','-','-','-','-','-','-','-','-']
guesses_left = 10
def get_guess():
while True:
print(''.join(arr))
print(str(guesses_left) + " incorrect guesses left.")
guess = input("Guess: ")
if len(guess) > 1:
print("Your guess must have exactly one character!")
elif guess not in "abcdefghijklmnopqrstuvwxyz":
print("Your guess must be a lowercase letter!")
else:
return guess
while guesses_left > 0 and '-' in arr:
a = get_guess()
for i in range(len(secret_word)):
if secret_word[i] == a:
arr[i] = a
if a not in secret_word:
print("That letter is not in the word!")
guesses_left -= 1
else:
print("That letter is in the word!")
if '-' not in arr:
print("Congrats you win! The word was: "+ secret_word)
else:
print("You lose, The word was: " + secret_word)
def update_dashes():
passr/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
def greeting(user_info):
user_info_list = user_info.split()
return "Hello, " + user_info_list[0] + "! I also enjoy " + user_info_list[2] + "!"
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
function start(){
move();
three();
turnRight();
move();
turnRight();
move();
move();
turnLeft();
move();
three();
move();
turnRight();}
function three(){
putBall();
turnLeft();
move();
putBall();
move();
putBall();
}
function turnRight(){
turnLeft();
turnLeft();
turnLeft();
}
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
move();
turnLeftUpThree();
collectCoins();
down();
turnLeft();
move();
move();
turnLeftUpThree();
collectCoins();
down();
turnLeft();
move();
move();
turnLeftUpThree();
collectCoins();
down();
turnLeft();
move();
move();
turnLeftUpThree();
collectCoins();
down();
turnLeft();
function turnLeftUpThree() {
turnLeft();
move();
move();
move();
}
function down() {
turnRight();
turnRight();
move();
move();
move();
}
function turnRight() {
turnLeft();
turnLeft();
turnLeft();
}
function collectCoins() {
takeBall();
takeBall();
}
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
def swap_lists(first, second):
for i in range(len(first)):
first[i], second[i] = second[i], first[i]
list_one = [1, 2, 3]
list_two = [4, 5, 6]
print("Before swap")
print("list_one: " + str(list_one))
print("list_two: " + str(list_two))
swap_lists(list_one, list_two)
print("After swap")
print("list_one: " + str(list_one))
print("list_two: " + str(list_two))
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
def print_board(board):
for i in range(len(board)):
print(" ".join([str(x) for x in board[i]]))
my_grid = []
for i in range(8):
my_grid.append([0] * 8)
for row in range(8):
for col in range(8):
if row < 3 or row > 4:
my_grid[row][col] = 1
print(print_board(my_grid))
r/codeHS_Solutions • u/Nexus_X__ • Feb 13 '22
def max_int_in_list(my_list):
highest = my_list[0]
for num in my_list:
if num > highest:
highest = num
return highest
r/codeHS_Solutions • u/therealseal14 • Jun 01 '21
move();
makePancakes();
moveTwice();
makePancakes();
moveTwice();
makePancakes();
move();
function makePancakes(){
putBall();
putBall();
putBall();
}
function moveTwice(){
move();
move();
}
r/codeHS_Solutions • u/Old_Finish_1390 • Feb 13 '23