Local variables cannot be accessed in a method, but can in a block.
ex. this is not possible
greet = 'hello!'
def greeter(str)
puts greet + str #greet is not accessible inside the method.
# Tic Tac toe | |
require 'pry' | |
INITITAL_MARKER = ' ' | |
PLAYER_MARKER = 'X' | |
COMPUTER_MARKER = 'O' | |
def prompt(msg) | |
puts "=>#{msg}" | |
end |
# Fizz buzz, using input(). Added a while loop that will keep the user in the game until they supply a valid integer. | |
while True: | |
try: | |
n = int(input("Pick a number to be buzzed: ")) | |
for i in range(1, n+1): | |
if i % 15 == 0: | |
print("FizzBuzz!") | |
elif i % 3 == 0: | |
print("Fizz") |
import random | |
questions = { | |
"strong": "Do ye like yer drinks strong?", | |
"salty": "Do ye like it with a salty tang?", | |
"bitter": "Are ye a lubber who likes it bitter?", | |
"sweet": "Would ye like a bit of sweetness with yer poison?", | |
"fruity": "Are ye one for a fruity finish?", | |
} |
from sqlalchemy import Table, Column, Integer, String, ForeignKey | |
from sqlalchemy.orm import relationship | |
pizza_topping_table = Table('pizza_topping_association', Base.metadata, | |
Column('pizza_id', Integer, ForeignKey('pizza.id')), | |
Column('topping_id', Integer, ForeignKey('topping.id')) | |
) | |
class Pizza(Base): | |
__tablename__ = 'pizza' |
from datetime import datetime | |
from sqlalchemy import Column, ForeignKey, Integer, Float, String, DateTime | |
from sqlalchemy.orm import relationship | |
from database import Base, engine | |
class User(Base): |
public class PrintingLikeBoss { | |
// copy or rewrite the method of Assignment 39.1 here | |
public static void printStars(int amount) { | |
while (amount > 0) { | |
System.out.printf("*"); | |
amount--; | |
} | |
System.out.printf("\n"); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Geolocation</title> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<!-- Optional theme --> |
import java.util.Scanner; | |
import java.lang.Math; // Note: Needed for math functions | |
class PaintEstimator { | |
public static void main(String[] args) { | |
Scanner scnr = new Scanner(System.in); | |
double wallHeight = 0.0; | |
double wallWidth = 0.0; | |
double wallArea = 0.0; |
{ | |
"public_identifier": "blakebharris", | |
"profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/blakebharris/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20240624%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20240624T134223Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=03093473c216a64666526e37370ab218e1b0ea35283fa4c9ac4f03f4244632ca", | |
"background_cover_image_url": null, | |
"first_name": "Blake", | |
"last_name": "Harris", | |
"full_name": "Blake Harris", | |
"follower_count": 659, | |
"occupation": "Engineering Manager I at Guild Education", | |
"headline": "Engineering Manager", |