assignment_1's People
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.