Giter VIP home page Giter VIP logo

assignment_1's People

Contributors

xxue avatar

Watchers

James Cloos avatar  avatar

assignment_1's Issues

Ruby assignment marking

Question 1

This solution works! Although the intent with the titleize method was to take a string as an argument, instead of from user input. So something like:

def titleize(string)
  # ...
end

gets.chomp works great when your user is running the code in their terminal, but most of the time the methods you write will be used by other methods, so you can't get user input directly.

Question 2

Very good code organization! Indenting is key to readable code ๐Ÿ˜„

Same comment as question 1, though. User input shouldn't be used to pass values to classes. Instead, you can initialize the class like this:

class Book
  # ...

  def initialize(title: "", chapters: "")
    # ..
  end

Question 3

We looked at this in class ๐Ÿ‘

Question 4

Nice and concise!

One small note: it's good practice to name block variables clearly, the one exception being if the thing is just a number. For instance:

major_cities.each do |province, cities|
  # ..
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.