Write a program that prints the longest substring

Assignment Help Python Programming
Reference no: EM132255383

Question 1

Assume s is a string of numbers.

Write a program that checks the string s 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:

2 - 7
3 - 8 14
5 - 0 6 11
7 - 3 13

Give Five (5) different examples with its output.

Question 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 descending order is: 742

Question 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

Question 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.

Question 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".

c

a

b

c

a

b

3

1

2

3

1

2

 

 

 

 

 

 

a

p

p

l

e

s

1

16

16

12

5

19

 

 

 

 

 

 

4

17

18

15

6

21

d

q

r

o

f

u

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

Question 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

Reference no: EM132255383

Questions Cloud

What is the expected number of happy points for this person : You are sitting in an establishment and you look over and you see the absolute best person for you. What is the expected number of happy points for this person?
How does he or she attempt to get this desire : Select one symbol from the play. What is the meaning or significance of the symbol? How is it used to further the story?
How does hawthorne express skepticism about the puritans : How might it be argued that Martin Luther inadvertently brought about the "rise of the individual" in Western culture?
Discuss about the cost-benefit analysis : Explain how you think the cost-benefit analysis in the statement from page 27 of Feldstein (2006) affected efforts to repeal/replace the ACA.
Write a program that prints the longest substring : HIT137 SOFTWARE NOW - Charles Darwin University - Write a program that prints the longest substring - Write a python program that allows the user to navigate
What did the salary analysis inform you about the position : What did the salary analysis inform you about the position?
Discuss the major local and international obstacles : Discuss the major local, national, and international obstacles to implementing standardized terminologies within EHRs. The response must be typed.
Airports often offer financial help for marketing-promotion : Discuss why airports often offer financial help for marketing and promotion for new services and/or airlines?
What is the impetus and rationale for your selection : NR506 Identify your selected healthcare concern (Healthcare Concern - Shortage ofo primary care physicians) in your city or state that needs your advocacy.

Reviews

len2255383

3/13/2019 1:47:39 AM

Then set the font of any code to be “Consolas” or “Courier New”. DO NOT include images/screen shots of code. Any images of code will not be marked. If your submission is difficult to understand, you will lose marks. When ready, post your single Word document to the Assignment Submission forum in Learnline. IMPORTANT TO NOTE: DO NOT use functions / commands to solve problems which were not taught in the class.

len2255383

3/13/2019 1:47:30 AM

How to submit this assignment Your submission should be written in a single Word document. Clearly label each question and any sub-sections. Provide maximum possible comments so the code becomes easier to read. Copy and paste your code into the document under each related question heading. Then select the section of code and under the ‘Home’ tab in MS Word, select ‘Styles’ > No Spacing. (This will remove all the extra blank lines from your code and make it easier to read.)

Write a Review

Python Programming Questions & Answers

  Create a program that calculates the estimated hours

Create a program that calculates the estimated hours and minutes for a trip. This should include an estimated date/time of departure and an estimated.

  You are tasked with improving the code for the haunted

you are tasked with improving the code for the haunted house game. please read the associated hand-out and the code

  What is a python development framework

What's a python development framework? give 3 examples python development framework used today.

  Write a function comp(d1,u1,d2,u2)

Write a function comp(d1,u1,d2,u2)

  Create a simple web interface for a to-do list application

Create a simple web interface for a To-Do list application, using what was learned in the reading for week - Flask web development framework

  The number of lowercase letters in the file

The number of uppercase letters in the file The number of lowercase letters in the file

  Make a python program that print a result of entered formula

Make a python program that print a result of entered formula which is consisted of 3 operators and 4 operands (example formula: 4*2-100/2).

  What is the difference between cause and correlation

What is the difference between cause and correlation? What is the difference between mean and median? When would you present either the mean or median value?

  Relation to the linear regression and the dataset

Build the in relation to the gradient boost tree and the dataset - Select a dataset (other than the example dataset given in section 3)

  Write a program that reads in words entered by the user

CSCI 1100 Computer Science Homework - Loops and Lists. Write a program that reads in words entered by the user and checks whether the word at least 8 characters

  Program using a loop that displays the projected semester

Write your program using a loop that displays the projected semester tuition for the next 7 years - You should then display the actual year

  Cleint software so that it does not display

Rewrite the cleint software so that it does not display an echo of a message sent by the users. Maybe it means that each time a user tries to send a private message that same message is also sent back to them? summary: stop that from happening?

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