Write a program that checks the strings for the values

Assignment Help Programming Languages
Reference no: EM132101533

Question 1: Assume s is a string of numbers.

Write a program that checks the strings for the values '2', '3', '5' and '7'. When one of the values is found in the string, record its position within the string and continue to check for more occurrences. Finally, output the results found.

For example, if s = '568714523645873', your program should print:

Give Five (5) different examples with its output.

2. Assume s is a string of numbers.

Write a program that prints the longest substring of s in which the numbers occur in descending order. For example, if s = '561984235870154755310', then your program should print

Longest substring in numeric descending order is: 755310

In the case of ties, print the first substring. For example, if s = '742951', then your program should print

Longest substring in numeric descendingorder is: 742

3. You have recently returned to Australia after a holiday abroad. You have some unspent foreign currency that you need to convert back into AUD (Australian Dollars). Write a program that will allow you to enter two or more amounts of foreign currency and theirassociated exchange rate. Convert the amounts back into AUD and print the total sum of AUD received once all conversions are complete.

Resulting program output might look similar to:

Enter currency amount: 100

Enter exchange rate: 0.75

100.0000 / 0.7500 = 133.33

Enter currency amount: 100

Enter exchange rate: 0.50

100.0000 / 0.5000 = 200.00

Total AUD received = $333.33

4. Write a python program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program quits. Otherwise, the program prints the line associated with that number.

5. Write a program that encrypts and decrypts the user input. Note - Your input should be only lowercase characters with no spaces.

Your program should have a secret word that will be used for encryption/decryption. Each character of the user's input should be offset by the value of the same character in your secret word. For example, if my secret word is "cab" and the user wants to encrypt "apples".

The encrypted output would be "dqrofu".

The program should ask the user for input to encrypt, and then display the resulting encrypted output. Next your program should ask the user for input to decrypt, and then display the resulting decrypted output.

Enter phrase to Encrypt (lowercase, no spaces): apples

Result: dqrofu

Enter phrase to Decrypt (lowercase, no spaces): dqrofu

Result: apples

6. Write a python program that accepts a text file as input. The program should read the text file and display all unique words in alphabetical order. It should then display the non-unique words and the number of times that they occurred in the input text.

Input file contains the following text:

how much wood would a woodchuck chuck if a woodchuck could chuck wood

Expected outcome should resemble:

Non-unique words and number of occurrences in no particular order:

wood : 2

a : 2

woodchuck : 2

chuck : 2

Unique words in alphabetic order:

could

how

if

much

would

Information related to above question is enclosed below:

Attachment:- Assignment1201814.rar

Reference no: EM132101533

Questions Cloud

Prepare income statement and statement of financial position : Provide for depreciation of plant and machinery at 10% and fixtures and fittings at 15% p.a. Prepare an income statement and statement of financial position
Evaluating a work of art requires some distance from piece : Evaluating a work of art requires some distance from the piece. You will be asked to analyze the artifact that you select and to describe why the piece.
Calculate gearing ratio using market value : The ordinary shares are quoted at 125 per share, loan stock is trading at $85 per $100 nominal and preference shares. Calculate gearing ratio using market value
How much of the loss on the distribution : One of the shareholders owns 60% of the corporation. How much of the loss on the distribution is deductible by the corporation
Write a program that checks the strings for the values : Write a program that checks the strings for the values '2', '3', '5' and '7'. When one of the values is found in the string, record its position.
Literary response for plot as a device : ENG 130 Literature and Comp - create a similar play-styled response about Post-its that portrays the life story of someone you know OR the life of a character
Determine the wacc given the given assumptions : "We will need to determine the required return for our intended project so that we have a decision criteria defined for the project," she says.
What is greatest strength : 1. What is greatest strength? 2. What is biggest weakness? 3. What makes the best person for the job? 4. Where do you see yourself in 5 years?
How do they make money and what is their biggest risk : Research at least two different restaurants or other related food service type companies .

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd