azywong / p0_unit1_submission Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gregknudsen-zz/p0_unit1_submission
Unit 1 Repository for students to submit their work
This project forked from gregknudsen-zz/p0_unit1_submission
Unit 1 Repository for students to submit their work
I had a similar solution to your's to use the reduce method. On reviewing another solution I realized that this soution wont work if the input is not an array!. I learnt a new method called .is_a? which can be used to determine if the input is an Array of 'Fixnum and if its an array use the 'reduce' method. Here is how the code looks -
def get_grade(input)
if input.is_a? Array
average = input.reduce(:+).to_f / input.length
elsif input.is_a? Fixnum
average = input
end
I thought I will share this with you. I didnt know about this before.
In your method for Sentence maker , you can try and use the Join method. This will join the elements of an array by the given separator.
e.g:- if I have an array of array = ["x","y","z"]
and I do - array.join(",") it will give me "x,y,z".
Apart from that I think your code looks good. Your variable names are well-defined and pseudocode is easy to follow.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.