ICT112 Programming Fundamentals Assignment Help and

Assignment Detail:- ICT112 Programming Fundamentals - University of the Sunshine Coast Theme: Training Turtles Learning Objective 1: use variables to store values and update those values; Learning Objective 2: draw simple shapes using Python 'Turtle Graphics' objects; Learning Objective 3: use for loops to repeat a block of code a given number of times- Training a Turtle One of the fun things about the Python language is that one of its standard libraries is the 'Turtle Graphics' module- Turtles are a great visual way of learning about Python objects and methods, and practicing the problem-solving skills that are crucial to learning programming- If you are using your own computer and haven't already you'll need to install VS Code and the Python libraries- If you are in the labs, please open VS Code and create a new python file- Note: you do not need to type in the 'comments' -everything from the '#' character to the end of the line-- Python ignores everything after a '#', so you can put comments in your code, but they just for human readers, to explain what is going on, and why the code is written that way- You should see an output window pop up at this point- Drag it over to the right side of your screen so that it does not overlap your code window- Then type in the next few lines and watch what alex -the 'turtle'- does- and a turtle object that we call 'alex' -short for 'alexander' or 'alexandra'???? It is difficult to know the sex of turtles! Then we give 'alex' a few instructions on how to move, and as he/she moves along, a line is drawn in the imaginary sand- You can find more explanation of this program and more details about turtles in Chapter 4 -'Python Turtle Graphics'- of our online textbook:Make sure you read that chapter sometime this week, if you are reading that one- Another useful source of reference documentation about turtles is the online Python documentation: 1-1 Some Simple Polygons Here is a series of simple shapes to draw, to learn how to control the turtle and figure out how the angles work- After you complete each task, add an explanatory comment line above your code to explain what it does -for example: # draws a square-- Then start drawing the next shape, by copying and pasting any bits of code that you need to reuse- Extend the above program so that it draws the whole rectangle, 50 pixels wide and 30 pixels high- 1- Modify the rectangle code so that it draws a square, 100 by 100 pixels- 2- Add some extracode to draw an equilateral triangle, with three sides, each 100 pixels long- 3- Also draw a hexagon that has six sides, each 100 pixels long- Hmm, this hexagon code is getting to be a bit long and repetitive- Imagine how long our program would be if we wanted to draw a shape with 20 sides! Can you use a for loop to make your hexagon code shorter???? Hint: for side inrange-6-: --- -Make sure that all the code you want to repeat inside the loop is indented by four spaces-- 4- Define a variable: size = 90- Then change your hexagon code so that it uses your sizevariable for the length of each side- Rerun your hexagon code- 5- Change your sizevariable to be 180- Then rerun your hexagon code- Does it look larger???? 1-2 Making it colourfulLet's make our shapes picture look a bit more colourful-We can call alex-pencolor-"red"- to set the colour of the pen to red - note the American spelling of 'color' in the method name- Okay, now beautify your three shapes as follows:• Change your square so that it is filled in with a nice light colour- Hint: ask alex to begin_fill-- before you start drawing the square, and end_fill-- after you finish drawing the square- The end_fill--method will paint the interior of the shape that you have just drawn- You can call alex-fillcolor-"color name"- to set the fill color any time before you call end_fill---• Change your triangle so that it is also filled in, but choose a darkeror complementary colour that fits in nicely with the colour of your square-• Change your hexagon so that it is drawn with dark, bold lines, 5 pixels wide- It should not be filled, just an outline shape- Choose a darkcolour for the lines, so that the hexagon creates a nice border for your picture-Your final picture should look something like this -but with your colours-: 2 Going a bit loopyFor this final part of the lab, we are going to use Python for loops to draw some slightly more interesting and complex pictures- 2-1 From Circles to SpirographsNow, copy and paste the following example code into your program: You will find that this draws a circle- But rather slowly, because it takes 360 tiny left turns to get around the whole circle! Try reducing the 360 iterations to just 36, and increase both 1's to 10, and it will draw more quickly, but still look quite close to a circle-To make a more interesting picture, copy the code for your triangle and paste it inside this circle loop -just after the alex-left-10- line-- Make sure that your triangle code is indented the same amount as the preceding lines, so that all the code inside the loop is at the same level- This is how Python knows which lines of code are inside the loop- Then run your program again and see what you see- 2-2 Spiralling AroundExperiment with varying the length of the forward-10- method call at the top of the loop- Also try changing it to forward-10+i--Then can you change your program so it draws a spiral of triangles like the ones shown here????Or get creative, and see if you can draw some more interesting spiral shapes! 2-3 The Drunk PirateA drunk pirate makes a random turn and then takes 100 steps forward, makes another random turn, takes another 100 steps, turns another random amount, etc- A social science student records the angle of each turn before the next 100 steps are taken- Her experimental data is:angles = -160, -43, 270, -97, -43, 200, -940, 17, -86---Positive angles are counter-clockwise--Write a turtle graphics program, which uses your turtle to draw the path taken by our drunken friend- Make his path wide and red-Hint: to loop through the angles, after you have added the above definition of the list of angles, you can use: for a in angles:-Extension- A random drunk pirate????Instead of following the same -historical- path of the same drunk pirate every time your program runs, can we model a drunk pirate who takes a different -and random- path each time???? Yes, Python has a ‘random' module that makes it easy to do this- Can you integrate this idea of 'random angles' into your program, to simulate a real drunk pirate????Can you make him/her turn right as well as left randomly???? Computer workshop 2: Theme: Chatbots Some of the earliest "smart" software systems were chatbots like Eliza -Eliza: Wikipedia- which you can test out In this workshop you'll build your own mini Eliza through a step-by-step tutorial from Hour of Code and then design and build your own ICT112 chatbot for frequently asked questions and/or importand information- Learning Objective 1: use variables to store values and update those values;Learning Objective 2: use conditional statements and Boolean logic to determine the next step/s;Learning Objective 3: use for loops to repeat a block of code a given number of times- 1- Talk to ElizaVisit at ElizaBot to try out an implementation of the original Eliza-Now try a more modern chatbot at CleverBot 2- Build your own Eliza Using the Hour of Code tutorial at Grok Learning build your own Eliza- Make sure you keep a copy of all the code you write in a separate word document 3- An ICT112 Chatbot a- Design your own chatbotUsing what you learned in the Eliza tutorial design in pseudo code OR flow chart -you may use whichever one best suits you- an ICT112 chatbot that can conduct a quiz about the content from week's 1 & 2 - the big 5 imperative programming constructs, the setup of the course, or any other question you'd want answered as a new ICT112 student-Your chatbot must have at least 5 questions or helpful hints- &needs to include at least one conditional and at least one for loop- -HINT: you'll likely need more conditions!- b- Build your own ICT112 chatbotNow implement your ICT112 chatbot according to your design, and test that it works- Attachment:- Programming Fundamentals-rar

Most Recent Questions


Helping Students for Excellence in Academics, GET Help with Assignment? Order Now