This function takes in a string as a parameter and prints the average number of characters per word in each sentence in the string. Print the average character count per word for each sentence with 1 decimal precision (see test cases below).
Assume a sentence always ends with a period (.) or when the string ends.
Assume there is always a blank space character (" ") between each word.
Do not count the blank spaces between words or the periods as a character.
Two example test cases are:
>>> processString("An example. Dog")
4.5 3.0
(Note that the first sentence has 2 words with a total of 9
characters, so 4.5 characters per word on average. The second
sentence has 1 word of 3 characters, so 3 characters on
average.)
>>> processString("This is the first sentence. The
second sentence starts after the period. Then a final
sentence")
4.4 5.3 4.5
In: Computer Science
Using Python
The logic is built to examine the process incoming data for specific items of information. This may need to be done in specific order with multiple processing steps.
You are to run your script of this test data file. Screen shot your interactions with the user for your submission document. Then place your analysis file, your python code file, and your submission document into a single zip file.
Some advice would be since you have the test data file, you can do these calculations by hand and check them against your analysis file to see if your program is working correctly.
In: Computer Science
Vocabulary: write the definition of the following words capital letters and give a synonymous for each word, then use the each word in a sentence. (TIRADE, WIZENED, PULCHRITUDINOUS, DISSEMINATE, CLEAVE)
In: Electrical Engineering
java please.
A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome.
Ex: If the input is:
bob
the output is:
bob is a palindrome
Ex: If the input is:
bobby
the output is:
bobby is not a palindrome
Hint: Start by removing spaces. Then check if a string is equivalent to it's reverse.
Hint: Start by just handling single-word input, and submit for grading. Once passing single-word test cases, extend the program to handle phrases. If the input is a phrase, remove or ignore spaces.
In: Other
Suppose that a system uses DMA for data transfer from disk controller to main memory. Further assume that it takes t1 nsec on average to acquire the bus and t2 nsec to transfer one word over the bus (t1 >> t2). After the CPU has programmed the DMA controller, how long will it take to transfer 1000 words from the disk controller to main memory, if
(a) word-at-a-time mode is used?
(b) burst mode is used?
Assume that commanding the disk controller requires acquiring the bus to send one word and acknowledging a transfer also requires acquiring the bus to send one word.
In: Computer Science
.text
.globl main
main:
lui $8, _______ # the address of pairs (SPIM:0x1000;
Mars:0x1001)
lw $9, 0(_____) # get the number of pairs (6) and
store in $9
ori $10, $0, 0 # use $10 to store the height sum
ori $11, $0, 0 # use $11 to store the weight sum
ori $12, $0, 0 # use $12 to count
ori $13, $0, 0 # use $13 to store temp values;
addiu $8, $8, ___ # increase the address to get the first
pair;
loop: ___________________ # jump to compute the average if
count==number of pairs
____ $13, ____ # get height and store in $13
add ___________ # update the height sum using
$10
addiu $8, $8, ___ # increase the address
____ $13, ____ # get weight and store in $13
add ___________ # update the weight sum using
$11
addiu $8, $8, ___ # increase the address
add ___________ # increase count
j loop
ave: div ________ # compute the average of
height
___ $10 # store the height average in $10
div ________ # compute the average of weight
___ $11 # store the weight average in $11
.data
pairs: .word 6 # number of pairs
.word 30, 60 # first pair: height, weight
.word 65, 51
.word 27, 67
.word 68, 270
.word 62, 115
.word 42, 43
## End of file
In: Computer Science
Using python, please complete these 4 exercises. Please limit your code to these skills:
For loop
While loop
Input function
F strings
Tuples
Lists
Nested ifs
Elias
Exercise 1
Using the following list, do the following:
[15, 70, 15, 38, 49, 98, 62, 89, 2, 21, 40, 74, 36, 36, 65, 1, 55, 16, 24, 56]
Exercise 2 (1 Point):
Using the following list, do the following:
1. Iterate through each element in the list
2. Print out whether the element is positive or negative or zero on a new line for each element.
[-2, 1, -2, 7, -8, -5, 5, 10, -6, 7]
Exercise 3 (2 Points):
Create a new list using the range function, appending the values from the range function's output into the list.
The range function must:
Hint: Use either a for loop or a list comprehension
Exercise 4 (6 Points):
In this exercise, you will be required to do the following:
Take the following phrase: The only thing we have to fear is fear itself
So, the end result should be:
Hetay onlyway hingtay eway avehay otay earfay isway earfay itselfway
In: Computer Science
Java
If the word contains the letter "y", there are some special rules that must be applied:
In the rules above, the letters "a", "e", "i", "o", and โuโ are considered vowels, and all other letters are considered consonants, except for โyโ as described above.
Other Characters
Beyond translating words, there are a few other rules to be aware of.
Program Specification
Input
Our program should accept input in one of two ways:
Each run of the program may consist of multiple lines of input. The total number of lines will vary. Input will end with either an EOF (end of file) marker, or a blank line of input. Your program should stop accepting input when either of these situations occurs.
Each line of input will contain words to be converted to Pig Latin. You may assume that the lines will only contain letters a-z A-Z, spaces , and common punctuation marks that are placed at the end of words !.,?.
You may assume that words are separated by spaces, but they may have attached punctuation marks at the end.
Input 1
hello world
Output 1
ellohay orldway
Input 2
A good day to Kansas!
Output 2
Ayay oodgay ayday otay Ansaskay!
In: Computer Science
(IN YOUR WORD) write a 400-word long, five paragraph essay about effect of Noise pollution
(SUPPORTED with a clear THESIS STATEMENT and five well-developed paragraphs)
In: Psychology
Here is a Problem I need to solve:
5) Write a function to determine is a given word is legal. A
word is illegal if it contains no vowels. For this problem,
the letter Y is considered to be a legal vowel. Pass in a word to
this function and it will determine if the word is
legal or not. You can make the following assumptions about the word
you a passing to this function.
1) The string being passed is a combination of letters only (no
non-letter check needed)
2) The string being passed is null terminated
3) Letters may be capital or lower case and it has no effect on
whether its a word
I think I am in the right direction below. But the problem is my proposed solution involves two separate functions. My question is how I can make this one function?
int isVowel(char c){
if(c>='A' && c<='Z')
c=c+32;
if(c=='a' || c=='e' || c=='i'|| c=='o'|| c=='u'|| c=='y')
return 1;
else
return 0;
}
int validString(char *c){
int i;
for(i=0;c[i]!='\0';i++)
if(isVowel(c[i]))
return 1;
return 0;
}
In: Computer Science