Question

Write a function named vertical that accepts a string as its parameter and prints each letter...

Write a function named vertical that accepts a string as its parameter and prints each letter of the string on separate lines. For example, a call of vertical("hey now") should produce the following output:

h

e

y

n

o

w

0 0
Add a comment Improve this question Transcribed image text
Answer #1


def vertical(s):
    for ch in s:
        print(ch)


vertical("hey now")

Add a comment
Know the answer?
Add Answer to:
Write a function named vertical that accepts a string as its parameter and prints each letter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program is in C++. Write a function named wordStatsPlus that accepts as its parameter a string...

    Program is in C++. Write a function named wordStatsPlus that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of words, and produces a particular group of statistics about the input. You should report: the total number of lines; total number of words; the number of unique letters used from A-Z, case-insensitively, and its percentage of the 26-letter alphabet; the average number of words per line (as an un-rounded...

  • Program is in C++.   Write a function named wordStatsPlus that accepts as its parameter a string...

    Program is in C++.   Write a function named wordStatsPlus that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of words, and produces a particular group of statistics about the input. You should report: the total number of lines; total number of words; the number of unique letters used from A-Z, case-insensitively, and its percentage of the 26-letter alphabet; the average number of words per line (as an un-rounded...

  • Write a method named printReverse() that accepts an int array as its parameter and prints that...

    Write a method named printReverse() that accepts an int array as its parameter and prints that array in reverse order. This method should not have a return statement (void). - All elements should be printed on the same line, separated by a space - A new line should be printed after the entire array prints - If the array passed in held the values: {3,2,1} - Output: 1 2 3 //newline printed here

  • Write a function named factorCount that accepts an integer (assumed to be positive) as its parameter...

    Write a function named factorCount that accepts an integer (assumed to be positive) as its parameter and returns a count of its positive factors. For example, the eight factors of 24 are 1, 2, 3, 4, 6, 8, 12, and 24, so the call of factorCount(24) should return 8. Program is c++

  • 1.1. Write a function named "areFirstTwoTheSame AsLast TwoChars" that accepts a string. It returns true if...

    1.1. Write a function named "areFirstTwoTheSame AsLast TwoChars" that accepts a string. It returns true if the first two characters and the last two characters of the string are the same. It returns false otherwise. In addition, if the string is empty or has only one character, it also returns false. For example, these are the strings with their expected return values false falsc "AB" true "ABA" false "ABAB" trus "ABBA" false "ABCABC false "ABCCAB" true 1.2 Write a function...

  • Python Write a function named letter_function. The function should accept a string (i.e., any string) and...

    Python Write a function named letter_function. The function should accept a string (i.e., any string) and display the letters in that string. For example, if the function received "python 3.2". The following letters will be displayed: (Hint: you can use s.isalpha() to know if a character is a letter) p y t h o n

  • Write a function named mostFrequent that takes two parameters: 1. inFile, a string that is the...

    Write a function named mostFrequent that takes two parameters: 1. inFile, a string that is the name of an input file 2. outFile, a string that is the name of an output file The input file inFile exists when mostFrequent is called; mostFrequent must create outFile. The input file contains only lower case letters and white space. The function mostFrequent identifies the letter(s) that appear most frequently on each line of inFile and writes them to a corresponding line of...

  • Write a static method called printWithSpaces that takes a String as its parameter and prints the...

    Write a static method called printWithSpaces that takes a String as its parameter and prints the characters of the string separated by spaces. For example: > Methods.printWithSpaces("method") m e t h o d You should have a single space after the last character. This method should not return a value. That is similar to this code for printing the string vertically public static void printVertical(String s) { for (int i = 0; i < s.length(); i++) { char c =...

  • project-8a Write a function named count_letters that takes as a parameter a string and returns a...

    project-8a Write a function named count_letters that takes as a parameter a string and returns a dictionary that tabulates how many of each letter is in that string. The string can contain characters other than letters, but only the letters should be counted. The string could even be the empty string. Lower-case and upper-case versions of a letter should be part of the same count. The keys of the dictionary should be the upper-case letters. If a letter does not...

  • python3.x Write a function print_letter_count(word) that takes a string as a parameter and prints each unique...

    python3.x Write a function print_letter_count(word) that takes a string as a parameter and prints each unique character (in alphabetical order and lowercase) together with their frequency. For example: consider the following word: Programming The characters are: 1 x p, 2 x r, 1 x o, 2 x g, 1 x a, 2 x m, 1 x i and 1 x n. The output would be: a: 1 g: 2 i: 1 m: 2 n: 1 o: 1 p: 1 r:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT