2023 Question 1 Marks 05 Assume s is a string of numbers Write a program that checks | Assignment Collections

Computer Science 2023 HIT137 Assignment 1, 2018

2023 Question 1 Marks 05 Assume s is a string of numbers Write a program that checks | Assignment Collections

  

Question 1  Marks 05

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  Marks 05

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 Mark 05  

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 their associated 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 Mark 05

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  Mark 10

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 Mark 10

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

!End! 

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational