[challenge] Code in another language challenge!

challenge

#1

Hi, everyone!
Recently the user @jaaakee made a really fun topic about printing "Hello World!" in several different languages and I was amazed by it!
It was so cool to see all the different kinds of ways to print such simple statement.
Some languages, like Python, were quite simple but others, like Assemly (MIPS), weren't that much but both were truly great!
I think learning another language, even if not much, it's something incredible! Understanding things you once looked at them and said "How come?" to now "I know how to do this and even in a better way!" is so rewarding, at least that's what I think.

Well, I was thinking about doing another "challenge" called "Code in another language challenge" (seriously, I couldn't think of a better name) :sweat_smile:

In this challenge you'll tell the person above you to solve a problem in any language you want.
Example: if the next user tells me that I should create a program where I should check the lenght of a string in C++ and I'll do it.

Q: Should I post the code?
A: I think so or just take a screenshot so we'll know you tried.

Q: Should it be correct?
A: That would be good.

Q: Should it be complex?
A:

for no in range(0,10**2):
   print "No"!
   print "Just... no."
   print

But please, follow Codecademy rules so everyone will enjoy it!
And also do not bring exercises from another courses in Codecademy for someone else to do it for you.
Special thanks to @mtf!!

After all of this, it's all up to you, guys!
If you like it, feel free to post what the user above you should do and in which language!
Let's hope for no problems to be solved in Assembly :joy:

Edit: The problems shouldn't be too complex, the reason for this game is for people to have fun with it! Don't be afraid to be part it!


[Challenge] Who wants a challenge?
[challenge] The Hello World Challenge
#2

Do it then :wink:  


#3

There it is:

Now how about you check if any given number is an odd number in PHP?


#4

Not very great with PHP, but I guess here it is:

$number = 40;
if ($number % 2 == 0) {
  print "It's EVEN";
}
else {
  print "It's ODD";
}

It's almost identical to JS so it's not hard :stuck_out_tongue:


#5

Oh well, glad it was easy haha
If you want to continue to play, just tell me what should I code and with which language.


#6

Hmm... @jibblyj I want you to create a fizzbuzz program in Ruby! (or should they be simpler than that?

@g4be This should be fun :slightly_smiling: I'd recommend you change it from:

to:

The problems shouldn't be too complex

...since this is supposed to be fun and light challenges rather than actual very hard stuff. Just an opinion, though :slightly_smiling:

Edit:
Should I have addressed my request to you instead, Gabriel? Since you're the person directly above me.


#7

Hey, @zystvan!
Since I was the last one to post, I think it should be me!
Thanks for the heads about the complexity thing, I changed that and hopefully more people will join :slightly_smiling:

And for you ... hmm ... I want you to add all the values in a vector and print it out.
It should be in C++.


#8

@g4be I'll try, but what's a vector?


#9

@zystvan: My apologies, I translated it right away from Portuguese.
It's just like a list in Python but there's a difference because in C++ you need to tell what type your variable or vector is.
I've read some people calling it as array, that could be but not in Portuguese.
Here's an example:

int zystvan[10] = {}

Edit: It's an array, better not look vectors for now, they're a bit more complex unless you want for curiosity!


#10

@zystvan Never used Ruby in my life. Maybe you should do that.


#11

Doing it!
If you want to play, just tell us!
There won't be any complex challenges :slightly_smiling:


#12

Ideally, no exercise problems. It is expected there may be coincidences. Most of the material here is elementary, so simple and not very complex, and commonplace. Remember that mods can spot code that came from the exercises.


#13

Thanks, @mtf!!
I've updated it and hey, why not come and join us? It's being fun so far.
I'm currently playing with Ruby and it seems to be amazing!

Will post my solution soon!


#14

Thank you for enjoying my Hello World Challenge! :slightly_smiling:


#15

I believe this is how to do it:

Credit to a friend for helping me (teehee)

def fizzbuzz(limit)
  for i in 1..limit+1 do
    if i % 15 == 0
      puts "FizzBuzz"
    elsif i % 3 == 0
      puts "Fizz"
    elsif i % 5 == 0
      puts "Buzz"
    else
      print "#{i.to_s} "
    end
  end
end

fizzbuzz(20)


#16

@jaaakee: It was really fun! Why not come and join us? It's fun :slightly_smiling:
@zystvan: After dealing with end right after the if and while, here's my code:

It was really fun! The only problem was Ruby and it's syntax.
For a moment I mixed C++, Python and Ruby haha

@jibblyj: I've done the code too but not like you haha
Maybe my way of doing it wasn't the best haha

And also @jibblyj, I want you to write code that asks the user for a number N and prints the sum of the numbers 1 to n but only even numbers.
And that should be done in Python.


#17

Your challenge looks awesome! However, I have not learned Ruby yet. If anything comes up about JavaScript, I will attempt to do it. :smiley: (Currently learning a lot about JS and want to learn more. I already know Java, Python, and C++.)


#18

Is that x + y + z + a + b +c etc..?


#19

 
This is me. So me.


#20

Can I try in JS instead? Then I could look at it and try to convert it to Python.