Giter Site home page Giter Site logo

loops-chapter's Introduction

Ruby Practice

Run your Ruby file by typing ruby and then the name of the file you want to run in the Terminal.

If we want to run loops_multiples.rb, we can write the command:

ruby loops_multiples.rb

To re-run this command, you can use the UP and DOWN arrow keys to look at the history of commands you've run in a Terminal.

Loops

loops_letter_count.rb

Write a program that:

Asks the user to input a word and counts from 1 to however long the word is.

Example (apple is the input):

"Enter a word:"
apple
1
2
3
4
5
"apple is 5 letters long!"

loops_multiples.rb

Write a program that:

Asks the user to input a number. The program should print multiplication table of entered number from 1 to 10.

Example (2 is the input):

"Enter a number:"
2
2
4
6
8
10
12
14
16
18
20

loops_fizzbuzz.rb

Write a program that prints the numbers from 1 to 100, except

for multiples of three print “Fizz” instead of the number for multiples of five print “Buzz” instead of the number for numbers which are multiples of both three and five print “FizzBuzz”

Your output should look something like

1
2
"Fizz"
4
"Buzz"
"Fizz"
7
8
"Fizz"
"Buzz"
11
"Fizz"
13
14
"FizzBuzz"
16
# etc

Hint: if x is a multiple of y, that means that we can divide x by y and have nothing leftover. Do we have anything in our Ruby toolbox that can help find remainders? Look through your older readings.

Specs

Click here to see names of each test

loops_fizz_buzz.rb should output the correct response

loops_letter_count.rb should count 1 to 6 with the input of 'banana'

loops_letter_count.rb should count 1 to 15 with the input of 'fantasmagorical'

loops_letter_count.rb should count 1 with the input of 'a'

loops_multiples.rb should print the correct multiples from 1 to 10 with the input of '2'

loops_multiples.rb should print the correct multiples from 1 to 10 with the input of '3'

loops_multiples.rb should print the correct multiples from 1 to 10 with the input of '0'

loops-chapter's People

Contributors

bpurinton avatar jelaniwoods avatar pmckernin avatar

Watchers

 avatar  avatar  avatar

Forkers

raghubetina-appdev cole-appdev ktmishra1-appdev shreyadon-appdev ewinters92-appdev maudtimmermans-appdev msalier-appdev kbourgon-appdev dailtdoc jmoral-appdev-1 mylesbulla-appdev alexpfrom-appdev anindobanerjee-appdev anniechung93-appdev sandborn-chicago-booth 20appdev emarkman312-appdev tszwailoong-appdev lmindyuk2-appdev fgressierbooth-appdev chicagoboothcourse mwarner0-appdev madisonzeller-appdev myles-i-appdev arun-gokhale-appdev lyuhas0-appdev crhoover12-appdev wojciechsokolowski-appdev jbhusals-appdev reinstallinghope jgu4appdev geissler25-appdev mjuettne-appdev cristalbooth hintarando bwatson0-appdev juliajain19 josh-staske-booth-app-development cales413-appdev demand-side-solutions rmappdev2020 blee41-appdev llavan1-appdev jmurati-appdev application-development-course arvindang-appdev academicsbooth olgasworld sivakram9-appdev ryanwade-appdev senseenone ryannelis1988 kcrow372-appdev aopecho7 ishandil chicagobooth-application-development jimena-appdev bram-appdevo gbunch-appdev appdevcourse jmw686-appdev hgbooth-appdev jbrown34-appdev erikadenedu-appdev kharpe-appdev fallappdev2020 romanomar thisisyiweiatbooth jurgenuhlmann-appdev boothyepes0 app-dev-swh wermomz rhetherington26-appdev mlanno-appdev ngoossen-booth-appdev booth-appdevelopment-yisroel dveldman01-appdev wilsonreese-appdev chicagobooth-app-dev boothrm rodrigogop-appdev conesy4-appdev svenka8-appdev djp-app-dev clairehkim-appdev tvoutsos19 pedrogu-appdev junhongchoibooth azolezzi-booth-appdev ddimitrov777-appdev luisptmdf-appdev danieljee-appdev byront20-appdev avivellanki manudattan-appdev sach-dev-appdev waterpolowarrior-appdev2020 shreyaspawale-appdev cmadison-appdev kharris0-appdev

loops-chapter's Issues

More exercise ideas

This issue is to write down potential problems to be added to this project.

  • 99 bottles of bear on the wall

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.