Ad

Showing posts with label codecademy. Show all posts
Showing posts with label codecademy. Show all posts

Wednesday, February 10, 2016

Codecademy Learn Java tutorial walkthrough 10: relational operators

Codecademy basics tutorials always cover relational operators for each programming language taught. Relational operators refer to the !=, >, ==, <= in (5!=3) or (5>3) or  (5==5)  or (5 <= 7). Each is a test to see if the left and right side of the relational operator has the said relation. For example, 5!=3 will evaluate to true because it is testing for whether it is true 5 doesn't equal to 3, and that is indeed the case, so the result is true. What about (5==3)? It tests if 5 equals to 3, and the answer is no so it evaluates to false. The result of a statement with a relational operator almost always only returns only true or false. Do you remember what's the name of the data type that can only be true or false? Yes a Boolean. A Boolean can either be true or false. Why are relational operators useful?

For example in the previous exercise, we used Modulo to see if z % 2 is zero, which means z is even. We can ask the program to do something only of z is even. Below so the pseudo code to do that (pseudo code is descriptive English words that explains what the code which is yet to be written is intended to do).

if ( (z % 2) ==0) print "z is even!"

This code reads first calculate z % 2, and if that is 0, print out a message saying z is even


See the screenshot above for one of the many solutions to this exercise. Remember Codecademy requires you to use two whole numbers. And don't forget to end the line with a semicolon, else you may get a confusing error.


Codecademy Learn Java tutorial walkthrough 9 Math:modulo %

Modulo has always been a difficult concept for beginners. Codecademy tutorials always cover Modulo operator (the percentage sign %) because it is extremely useful in math, programming and engineering in general. This is a step by step, detailed programming language agnostic guide to how to use and understand the modulo operator. 

First of all don't think too much about the name of the percentage symbol. Let's first understand the concept of modulo. 

It's very useful when determining whether number x is divisible by number y. Say 10 is divisible by 1, 2, 5, and 10. The result is always a whole number: 10, 5, 2, 1 respectively. When x is divisible by y, the result of x modulo y is always zero. 10 % 1 = 0, 10 % 2 = 0. When x is divisible by y, the result is always zero, because there's no remainder. 10 % 3 = 1. Because 3x3=9 plus the remainder 1 equals to 10. And in this case, x moduloes y is not zero, and hence x is not divisible by y. 

And now another commonly used case for the modulo operator: determining whether a number is even or odd. It's useful say Udacity has an online class full of students, and now wants to divide the students methodically into different groups. The sorting method will be different depends on whether the number of students is even or odd. We can calculate that using z % 2. Z is the number of students. example 10%2 =0 makes 10 even. 9%2 = 1, so 9 is not even.


In this exercise, I set int myNumber equal to 11%3, and the remainder will be 2 because 3 x3 is 9, 9 plus 2 is 11, see the illustrated traditional calculation 




Tuesday, February 9, 2016

Codecademy Learn Java tutorial walkthrough 8 : Math +,-,*,/



In this exercise 8/12, Codecademy requires you to do some basic arithmetics using Java. Use the plus symbol + for addition, the minus symbol - for subtraction (it's a very short dash like the in the word "half-life"), the asterisk or the multiply symbol * for multiplication, the forward slash or the divide symbol / for division (the backward flash is \). 

In this case, you just have to multiply two whole numbers and store the result in a variable that can hold an integer. And that's exactly what line 4 does 
int myNumber = 5 * 6;

Don't forget the semicolon or ; at the end of the line. That's how Java knows a line has ended. Or else it will get confused when trying to execute line 4 and line 5 together and throw a nasty error message. This error message is Codecademy specific and can be confusing. If you included the semicolon correctly but still got this message check if you really multiply two integers and stored it successfully in a variable that int holds integers and the variable is called myNumber. 



The error message reads:
Did you multiply two integers?
Remember, integers are whole numbers only.

What's a whole number? 1, 3, 70, but not 3.5

Codecademy Learn Java tutorial walkthrough 7 comments

In this Codecademy.com Java exercise 7/12 Comments, the exercise requires you to "comment out" line 4 and make a multi-line comment.

Engineers use comment frequently to make their code more readable for other engineers and also their future self. Professional developers write thousands line of code in a matter of months or even days. It will be hard to remember all the nuances. Comments in plain concise English really helps. It's also a great way for beginners to take notes while learning to code.

"Commenting out" a line refers to prefixing the line with a // double slash in Java or surrounding the multi-line code (a code that continues on multiple lines) with /* and then ending with */ 

This seemingly trivial exercise is actually a testing method frequently used by developers to test what a line of code does or should not do. They comment out the target code line(s) to see how the program run without those line(s) of code.

In this exercise, part 2, you must write a multi-line comment. A single line comment marked with // won't pass part 2 of the exercise. Codecademy will throw an error. 

See my sample code screenshot below:




Saturday, December 14, 2013

Codecademy: Hour of Code review and significance

Codecademy has developed a mobile app to deliver a version of the Hour of Code initiative for CSEdWeek. This new development is significant: Codecademy is making its mobile debut! It also is spearheading initiatives introducing young people to code. Furthermore, it puts Codecademy easily accessible on mobile, which is often an on-and-off short interactions (unlike its website presence), and makes it a contender for your time. Competing with games and "less productive tasks", that is. See this useful CNN article for analysis. 

I was at one time the Codecademy girl, so I can't pass on the opportunity to write about my passion.

Summary review: this app is convenient, meant to be used on the go, zero experience required. It's Codecademy doing what it's best at teaching people to code by making it easy and fun, without the hassle of setting up. Learn coding *concepts* just got a whole lot easier. If you can use an iPhone, you can code.


Read about the mobile app and download it here on Codecademy.com
Continue the education on the website later click here also on Codecademy.com
Download from App Store right away use this
To access the app on iPad, be sure to search "codecademy" and change the filter to "iphone only" from "iPad only". This is the way to make all iPhone apps show on iPad.


  • Differentiating factor: a simple tap and code, or tap and learn approach. Students reach correct answers faster. Less frustration, and less need for full computer based research and workout
  • Of course no answer is ever free from Codecademy. Users still have to think and guess a bit. That's the part that Codecademy does the best: remove traditional computer science learning obstacles, but still make the lessons engaging, educational, and gamified with fun. 
  • De-myth: if you know how to use an iPhone you can code! And a lot of people can use iPhones. Codecademy is doing its best to get everyone to understand how to code.


  • Works out of the box: no need to log in.
  • JavaScript, the language of the web
  • iPhone ready: flat design, responsive works well visually on iPhone and iPad, tap and type features, tap and select 

  • Gamified
  • Push notification for new updates
  • Popup overlay displaying results of your code, i.e. console results
  • Multiple choices, there's a correct answer, no more frustrations
  • Walks through important basics

    • String, text, string concatenation
    • Printing
    • Calculations
    • Boolean true or false evaluation
    • Data types
    • Control Flow basics, if ... else ...
    • Variables
    • Functions
    • .... this is a living document and it will be updated. Even for experienced folks like myself I cannot get through codecademy's basic app in 15 minutes. It's indeed non-trivial.
  • Instant Feedback
Every person is different and has different learning styles. Codecademy may work for you, or not. Check out for Hour of Code +Hour of Code 2013  options on iPad, a mobile device.

President Obama's call to action.




Thursday, February 14, 2013

Codecademy now an essential tool for beginners

Did you know that Codecademy was down yesterday? It surely will be obvious if you are a beginner using the tool. A few girls at the Javascript study groups already told me that they weren't able to get their meeting going due to the outage.

A friend who tried a new tool was dissatisfied and quickly missed Codecademy. The funny thing was, she wasn't even a fan before. The outage (which unfortunately erased a few progress marks, and is currently being worked on by the Codecademy team for restoration) has somehow showed her just how important this tool is.

 Cheers to those yet to discover just how carefully designed the lessons are in this website. And one reason we loved it? It helped so many of us who didn't like reading tutorial books get started on coding. I still receive tweets on a daily basis about working moms, business practitioners, just everyday people learning how to code with Codecademy. Happy thoughts.

[Updated Feb 17]
For those affected by the outage, unfortunately some efforts are lost. As Codecademy does not charge a penny, and has gained quite a user base, it is hard for users like me to get mad beyond submitting a ranting support ticket. Codecademy supplied the apologies through multiple popups, but it wasn't enough, data was still lost. In the true spirit of #gamification - an element of the site - a 404 error badge was distributed to those affected! (super cute indeed) And it was promised that this will be a rare badge (reading between the lines : we are sorry and it won't happen very often, hence rare badge)


React UI, UI UX, Reactstrap React Bootstrap

React UI MATERIAL  Install yarn add @material-ui/icons Reactstrap FORMS. Controlled Forms. Uncontrolled Forms.  Columns, grid