diff_months: 21

ITECH1400: Fundamentals of Programming - Computer Science Assignment

Download Solution Now
Added on: 2022-08-20 00:00:00
Order Code: 8_19_5410_193
Question Task Id: 51801
  • Subject Code :

    ITECH1400

  • Country :

    Australia

Task -1 Building Thue-Morse Sequence

 

In this task you are required to write a Python function named thue_morse(n), that takes a positive integer parameter, n, and returns the string tn (defined above). In your program you

may define other (auxiliary) functions with arbitrary names, however, the solution function of this task should be named thue_morse(n).

n this task we defined python function called thue_morse(n) and then we initialized two string values ‘0’ and ‘1’ to X and Y.

As the next step we created a for loop start from 0 and it will

iterate until n (whatever number we called in function). Inside the for loop, we have a function X and Y and inverse of X and Y as Y and X. Finally, it will return the value of X

Ta

sk

2 Building a square-free word in the alphabet of three symbols

 

2.1. Construction of the Square-Free Word

 

2.2. The Programming Tasks

a)

You are required to write a Python function named square_free(n), that takes a positive 

integer parameter n and returns the string an (defined above).Again, as in Task 1, you may define other (auxiliary) functions with arbitrary names,however, the solution function of this task should be named square_free(n)

b)

Write a Python function named print3Blocks(s) that takes a string, s, as a parameter and 

prints it in blocks of 3 symbols separated by white spaces.

Task 3. Counting the number of squares in a string.In this task you are required to write a Python function named

count_squares(s)

that takes a string,

s

, as a parameter and returns the number of “squares” in

s

, i.e., the number of 

occurrences of two consecutive identical sub-words in

s

.

  • Uploaded By : Katthy Wills
  • Posted on : August 21st, 2018
  • Downloads : 0
  • Views : 598

Download Solution Now

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan

Premium

80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing
Most
Popular

Gold

30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%

Silver

20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more