RUBY DEBUG
3 errors in this debug. Please solve.
============================
#Get user sentence
puts "Please enter a sentence.\n\n"
input = STDIN.gets
input.champ!
vowels = input.downcase.scam(/[aeiou]/).count #Counts the vowels
consonants = input.downcase.scan(/[b-df-hj-np-tv-z]/).count #Counts the consonants
puts "Your sentence contains #{vowel} vowel(s) and #{consonants} consonant(s)." #Display counter
Answer: here is the answer for your code:
your code is:
#Get user sentence
puts "Please enter a sentence.\n\n"
input = STDIN.gets
input.champ!
vowels = input.downcase.scam(/[aeiou]/).count #Counts the vowels
consonants = input.downcase.scan(/[b-df-hj-np-tv-z]/).count #Counts the consonants
puts "Your sentence contains #{vowel} vowel(s) and #{consonants} consonant(s)." #Display counter
please change your code as:
#Get user sentence
puts "Please enter a sentence.\n\n"
input = STDIN.gets
input.chomp!
vowels = input.downcase.scan(/[aeiou]/).count #Counts the vowels
consonants = input.downcase.scan(/[b-df-hj-np-tv-z]/).count #Counts the consonants
puts "Your sentence contains #{vowels} vowel(s) and #{consonants} consonant(s)." #Display counter
OUTPUT :

I hope this would help you out
If you have any doubt, you can provide comment /feedback below the answer
Thanks
RUBY DEBUG 3 errors in this debug. Please solve. ============================ #Get user sentence puts "Please enter...
Write a program which gives the user the option to separate, Vowels or Consonant from a given text from a file. We will display the separated data on screen and also store it in output file. This is for C++ . Name of the input file to be used is: SeparateConVow.dat . The input file has this sentence: THIS IS THE FINAL PROJECT FOR OUR CLASS . The code should separate the vowels and consonants in that sentence. ^ ....
Provide immediate feedback for each mistyped sentence. To do so, modify the Test class’s present_test method so that it informs the player a mistake has been made, then display the challenge sentence followed by the player’s sentence so the player can determine where the error lies. #-------------------------------------------------------------------------- # # Script Name: TypingChallenge.rb # Version: 1.0 # Author: Jerry Lee Ford, Jr. # Date: March 2010 # # Description: This Ruby script demonstrates how to apply conditional logic # in order...
My Python file will not work below and I am not sure why, please help me debug! ********************************* Instructions for program: You’ll use these functions to put together a program that does the following: Gives the user sentences to type, until they type DONE and then the test is over. Counts the number of seconds from when the user begins to when the test is over. Counts and reports: The total number of words the user typed, and how many...
(1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Ex: Enter a sample text: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue! You entered: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews...
Hello, I have some errors in my C++ code when I try to debug it.
I tried to follow the requirements stated below:
Code:
// Linked.h
#ifndef INTLINKEDQUEUE
#define INTLINKEDQUEUE
#include <iostream>
usingnamespace std;
class IntLinkedQueue
{
private: struct Node {
int data;
Node *next;
};
Node *front; // -> first item
Node *rear; // -> last item
Node *p; // traversal position
Node *pp ; // previous position
int size; // number of elements in the queue
public:
IntLinkedQueue();...
please use python and provide run result, thank you!
click on pic to make it bigger
For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...
Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book tit le, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an...
Don't attempt if you can't attempt fully, i will dislike and negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book titnle, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an HTML web...