Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program with a function that accepts a string as an argument and returns the number of vowels that the string contains. The application should have another function that accepts a string as an argument and returns the number of consonants that the string contains.

The application should let the user enter a string and should display the number of vowels and the number of consonants it contains.

Sample output:

Enter a string: california

The string you entered includes 5 vowels and 5 consonants



Write a function called swap_pairs that accepts a string as a parameter and returns that string with each pair of adjacent letters reversed. If the string has an odd number of letters, the last letter is unchanged. For example, the call swap_pairs('example') should return 'xemalpe' and the call swap_pairs('hello there') should return 'ehll ohtree'.

Sample output for two separate runs:

example -> xemaple

hello there -> ehll hotree




Write a function called repl that accepts a string and a number of repetitions as parameters and returns the string concatenated that many times. For example, the call repl('hello', 3) should return 'hellohellohello'. If the number of repetitions is zero or less, the function should return an empty string. Do not use the string * operator in your solution; use the concatenation operator.

Sample output:

hello -> hellohellohello



This information was first posted in Week 10 and is now due this week.

You are the IT manager of a large corporation. You are planning to use Python to develop statistical models to aid in analyzing your sales data. You are preparing a report for management. Here are the basic requirements for your report:

  • Prepare in APA format
  • Include references
  • Report length: 500 - 700 words
  • Briefly describe your company
  • Briefly describe Python
  • Give overview of Machine Learning
  • Report on:'
  • Implementation plans
  • Technical training
  • Python libraries required
  • How Python will be used
  • Types of reports that will be produced

Consider the below given iris data set. This dataset contains 3 classes of 15 instances each and each class refers to a type of iris plant. The dataset has two features: sepal length, sepal width. The third column is for species, which holds the value for these types of plants. A new plant is identified. You have to classify the Species class of new identified plant with the help of KNN algorithm[. 



We would like to assess if there is any difference in the average price quotes provided by Mary and Barry. 


Q1. Write a program to input a string and count the occurrence of the word ‘the’(in any case) in the string.

For eg: if the input is:  The sun rises in the east.

Output should be:2

Q2. Write a program to input a string and count the number of words in it.                                               

For eg: if the input is: I like computer science.

Output should be:4

Q3. Write a program to input a string and print at which position a particular word exist.                          

For example :if the string is: I like computer science.

Word is:like(to be taken from user)

Output is 2 (as like is the second word in the string.)




Q1. Write a program to input n elements of a list and display  the following pattern:                         

Eg. If the elements entered by the user is :  1  2   3   4   5

The pattern printed should be:

1 0 0 0 0

1 2 0 0 0

1 2 3 0 0

1 2 3 4 0

1 2 3 4 5

Q2. Write a program to input a list of n elements and print all the prime numbers(if any) in the list. If the list does not contain any prime number,display ”No Prime Number in the List"

Q3. Write a program to input a list of N elements and rearrange it so that all odd elements appears after all even elements of the list.

Eg. If the entered list is:  1  2  3  4  5  6

Then the output list should be:

2  4  6  1  3




Write a function in this file called nine_lines that uses the function three_lines (provided below) to print a total of nine lines.

Now add a function named clear_screen that uses a combination of the functions nine_lines, three_lines, and new_line (provided below) to print a total of twenty-five lines. The last line of your program should call first nine_lines and then the clear_screen function.


The function three_lines and new_line are defined below so that you can see nested function calls. Also, to make counting “blank” lines visually easier, the print command inside new_line will print a dot at the beginning of the line:


def new_line():


print('.')


def three_lines():


new_line()


new_line()


new_line()


Modify the Monte Carlo simulation to plot points in the entire circle. You will have to adjust the calculated value of pi accordingly.



LATEST TUTORIALS
APPROVED BY CLIENTS