Posts

Showing posts with the label Ruby

Free Code Examples Directory

Image
Share with Friends Free Code Examples Directory and List of Codes by Language Free Code Examples is an excellent Resource for learning new Programming Syntax or just grabbing a piece of Code to add to your Current Project Java Codes Java Current Time snd Date Java Random Numbers Java Square Root Cube Root Square and Cube of Number Java Code to Reverse Number Java Code to Reverse String Java Program to Check if Input is Vowel Java Odd or Even Java Fibonacci Sequence Java Program to Create a Diamond 8 Codes to find Versions Hello World in 10 Programming Languages Python Codes Rock Paper- Scissors Game with Python Card Deck Class with Python Python GUI Fun with Turtle Python Word Repeater Program Scientific Notation using Python NASA API with Python Machine- Learning Logistic Regression Python Machine Learning L...

Ruby Reverse String

Image
Use this Ruby Code to Reverse Letters or Numbers in a String Ruby puts "original string" c = "abcdefg" puts c d = c.reverse! puts "your string reversed" puts d puts "original number" e = "123456" puts e puts "you number reversed" f = e.reverse! puts f Click here to run this code More Free Code Examples: Ruby Word and Letter Counter Javascript Easy Battleship Game Hello World in 10 Programming Languages Try these Fun Games by Bobbie: Travel Blast Game New York Play and Learn Russian Battlestarship Game Take a look at these Groovy Codes: Fun IQ Test Html Svg Starburst Javascript Particles Fishes Read the Latest Breaking Programming and Tech News, Great Articles and Tips: Codenewz Programming and Tech News

Ruby Word and Letter Counter

Image
Ruby Word and Letter Counter This simple Program will accept a string and return the total number of words and show the number of occurrences for each letter. Ruby #Enter a string to see word & letter counts puts "Enter your text:" text = gets.chomp puts  "#{text}" word_count = text.split(' ').count puts "Word count is #{word_count} \nLetter Frequency is:" text.downcase! freqs = {} freqs.default = 0 text.each_char { |char| freqs[char] += 1} ("a".."z").each {|x| puts "#{x} : #{freqs[x]}" } puts "Thank You" Click here to run this code More Free Code Examples: Javascript Substitution Cipher Javascript Easy Battleship Game Hello World in 10 Programming Languages Try these Fun Games by Bobbie: Travel Blast Game New York Play and Learn Russian Battlestarship Game Take a look at these Groovy Codes: ...

Hello World in 10 Programming Languages

Image
Java Hello World public class Hello {       public static void main(String[] args){           System.out.println("Hello World!");} } Click here to see this code run HTML5 Hello World <!DOCTYPE html> <html>     <head>         <title>Page Title</title>     </head>     <body>         <h1>Hello World</h1>     </body> </html> Click here to run this code Python Hello World print("Hello World") Click here to see this code run C Hello World #include <stdio.h> int main() { printf("Hello World");      return 0;} Click here to see this code run C++ Hello World #include <iostream> using namespace std; int main() { cout << "Hello W...