Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/barbarer/py4e-int
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarer committed Sep 11, 2024
2 parents 75d0bb9 + 501f91c commit d285ecc
Show file tree
Hide file tree
Showing 26 changed files with 917 additions and 716 deletions.
11 changes: 3 additions & 8 deletions _sources/turtles/SE_turtle/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Python 3 Turtles Practice
Study Information
^^^^^^^^^^^^^^^^^^^^^^

Hi, we are a team of researchers in Professor Ericson’s Lab at UMSI. You are invited to participate in a study to help CS entry-level learning.
You must be at least 18 years old to participate into this study. Your participation will help more novice programmers become successful in introductory computing courses in a low-cost, scalable, and easily adopted way.
Hi, we are a team of researchers in Professor Ericson’s Lab at UMSI. You are invited to participate in a study to help CS entry-level learning (UM IRB HUM00253438).
Your participation will help more novice programmers become successful in introductory computing courses in a low-cost, scalable, and easily adopted way.

This study has four parts. It will take approximately 40 minutes to complete it.
Please do the parts in order and answer questions to the best of your ability without any outside help including ChatGPT.
Expand All @@ -18,12 +18,7 @@ The four parts are:
- **Practice** - Complete four mixed-up puzzle pairs, followed by survey questions.
- **Posttest** - Includes 10 multiple-choice / true-false / short-answer questions.

Only your anonymous log fles from this session will be used for this study. No identifiable information will be collected. Participating in this study is completely voluntary.

If you do not meet the eligibility criteria or if you choose to withdraw your consent and wish to have your **anonymous responses** deleted, please click to withdraw from the study.

.. poll:: withdrawal
:option_1: I do not want to participate in this study.
Only your anonymous log fles from this session will be used for this study. No identifiable information will be collected. You will not be graded on your performance.

If you have questions at any time about the study or the procedures, you may contact the researcher at email xyhou@umich.edu.

Expand Down
9 changes: 0 additions & 9 deletions _sources/turtles/SE_turtle/pp-intro-IE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ You may need to indent the blocks as well. There may also be extra blocks that
needed in a correct solution that you can leave on the left side. Click the "Check" button
to check your solution.

See the video below for an example.

.. youtube:: Rf7oWHlo-e0
:divid: iwgex1-parsons1-ppie
:optional:
:width: 500
:height: 415
:align: center

Try to solve the following mixed-up code problem. This problem doesn't require any indentation.

.. parsonsprob:: intro-simple-parsons-ppie-1
Expand Down
9 changes: 0 additions & 9 deletions _sources/turtles/SE_turtle/pp-intro-PP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ may need to indent the blocks as well. There may also be extra blocks that are
needed in a correct solution that you can leave on the left side. Click the "Check" button
to check your solution.

See the video below for an example.

.. youtube:: Rf7oWHlo-e0
:divid: iwgex1-parsons1-ppnse
:optional:
:width: 500
:height: 415
:align: center

Try to solve the following mixed-up code problem. This problem doesn't require any indentation.

.. parsonsprob:: intro-simple-parsons-ppnse-1
Expand Down
24 changes: 9 additions & 15 deletions _sources/turtles/SE_turtle/pp-intro-SE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ may need to indent the blocks as well. There may also be extra blocks that are
needed in a correct solution that you can leave on the left side. Click the "Check" button
to check your solution.

See the video below for an example.

.. youtube:: Rf7oWHlo-e0
:divid: iwgex1-parsons1-ppse
:optional:
:width: 500
:height: 415
:align: center

Try to solve the following mixed-up code problem. This problem doesn't require any indentation.

.. parsonsprob:: intro-simple-parsons-ppse-1
Expand Down Expand Up @@ -100,21 +91,22 @@ The clicable area are those with a dark gray background and a border around them
You will then receive a completed explanatoin of the solution you got from solving the mixed-up puzzle.


<img src="https://i.postimg.cc/Kzgng2sJ/SE-introduction.png" width="500">

.. image:: https://i.postimg.cc/SmDGs7mZ/SE-introduction.png
:width: 600
:align: center

Four types of feedback will be provided for each option you select.

👉 Correct / Incorrect feedback
If you see a feedback message like "You are correct!" or "Incorrect.", it means you have selected the correct or incorrect option.

👉 Detailed feedback on how many options you got correctly or incorrectly.
👉 Detailed feedback on how many options you got correct or wrong.
If you see a feedback message like "You clicked on 1 of the 2 correct elements and 0 of the 3 incorrect elements.", it tells you the number of correct and incorrect options you selected.

👉 Hints on how to correct the incorrectly selected options.
👉 Hints on how to correct the wrong options.
If you see a feedback message like "Think about the type of the input parameter.", it provides hints on how to correct the incorrect options you selected.

👉 Highlighted incorrectly selected options
👉 Highlighted incorrect options
The Incorrect options you selected will be highlighted in pink background with a red border. You need to deselect the incorrect options and select the correct options.


Expand All @@ -127,7 +119,9 @@ Try to solve the following explanation problem. You can click on the options to
:feedback: (1) Think about the type of the input parameter. (2) Think about the operator used to concatenate two strings.

Here is a completed function:
<img src="https://i.postimg.cc/fTbCh4Rc/join-Strings-solution.png" width="500">
<img src="https://i.postimg.cc/fTbCh4Rc/join-Strings-solution.png" width="300">



(1) <b>Function Definition —— def joinStrings(str1, str2):</b>
Defines a new function and takes two parameters as inputs: str1 and str2. Both parameters are <b style="background-color:#d9d9d9">[:click-correct:string:endclick: / :click-incorrect:list:endclick:]</b>.
Expand Down
82 changes: 48 additions & 34 deletions _sources/turtles/SE_turtle/pps-IE-pp1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Practice Problems
:numbered: left
:adaptive:

Create a function called ``create_T`` that takes in ``turtle`` as a parameter and moves the turtle to create the letter T.
Create a function called ``create_T`` that takes in ``turtle_obj`` as a parameter and moves the turtle to create the letter T.
The width of the letter should be 100, and the height of the letter should be 150.
-----
from turtle import *
Expand All @@ -30,6 +30,8 @@ Practice Problems
turtle_obj.forward(height)


What to do next
^^^^^^^^^^^^^^^

.. raw:: html

Expand All @@ -39,44 +41,56 @@ Practice Problems
.. raw:: html


<script type="text/javascript">
<script type="text/javascript">
// Initialize a counter variable at a higher scope
let clickCount = 0;
document.addEventListener('DOMContentLoaded', () => {
let isC8 = false;
// Override the console.log function to capture the log event
const originalConsoleLog = console.log;
console.log = function (message) {
// Call the original console.log function to ensure the message still appears in the console
originalConsoleLog.apply(console, arguments);
// Check if the message contains the specific pattern
if (message.includes('Save logging event')) {
// Extract the JSON part from the log message
const jsonString = message.substring(message.indexOf('{'));
checkActValue(jsonString);
}
};
function checkActValue(loggingEvent) {
try {
const eventObj = JSON.parse(loggingEvent);
const actValue = eventObj.act;
const lastPart = actValue.split('|').pop();
if (lastPart === "c8") {
isC8 = true;
}
console.log(`Last part of act: ${lastPart}, isC8: ${isC8}`);
} catch (error) {
console.error('Error parsing the logging event:', error);
}
}
// Function to update the click count
function updateClickCount() {
clickCount++;
document.getElementById('clickCount').textContent = `Times Clicked: ${clickCount}`;
}
function handleLinkClick(event) {
const alertElement = document.querySelector('.alert');
if ((alertElement && alertElement.textContent.includes('Perfect!')) || isC8) {
return true;
} else {
event.preventDefault();
alert('Please try again to complete the mixed-up puzzle first.' + "\n" + 'Remember, you can click the "Help me" button to remove an unnecessary block or combine two blocks.' + "\n" + 'You can skip the puzzle after 8 attempts.');
return false;
}
}
// Function to check for presence of button and handle the link click
function handleLinkClick(event) {
// Check if an element with the class 'alert alert-info' contains the text 'Perfect!'
const alertElement = document.querySelector('.alert');
if ((alertElement && alertElement.textContent.includes('Perfect!')) || clickCount >= 8) {
// Allow the link to be followed
return true;
const linkElement = document.getElementById('ie1');
if (linkElement) {
linkElement.addEventListener('click', handleLinkClick);
} else {
// Prevent the default link action
event.preventDefault();
// Display a popup window
alert('Please try again to complete the mixed-up puzzle first.' + "\n" + 'Remember, you can click the "Help me" button to remove an unnecessary block or combine two blocks.' + "\n" + ' You can skip the puzzle after 8 attempts.');
return false;
console.error('Element with ID "ie1" not found.');
}
}
// Attach the click event handler to the link
document.getElementById('ie1').addEventListener('click', handleLinkClick);
document.addEventListener('DOMContentLoaded', () => {
// Get references to the button and the display element
const checkButton = document.getElementById('parsons-1-check');
// Add an event listener to the button
checkButton.addEventListener('click', updateClickCount);
});
</script>
91 changes: 55 additions & 36 deletions _sources/turtles/SE_turtle/pps-IE-pp2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ Practice Problems
def create_hexagon(turtle):
=====
for i in range(0, 6):
=====
turtle.forward(50)
=====
for i in range(0, 6):
turtle = turtle.forward(50) #paired
=====
for i in range(0, 7):
turtle = turtle.forward(50) #paired
=====
turtle.left(60)
Expand All @@ -27,51 +30,67 @@ Practice Problems
=====
create_hexagon(alex)


What to do next
^^^^^^^^^^^^^^^

.. raw:: html

<p>Click on the following link to go to the explanation: <a id="ie2" href="pps-ie2.html"><font size="+1"><b>Explanation</b></font></a></p>


.. raw:: html

<script type="text/javascript">
// Initialize a counter variable at a higher scope
let clickCount = 0;
// Function to update the click count
function updateClickCount() {
clickCount++;
document.getElementById('clickCount').textContent = `Times Clicked: ${clickCount}`;
}
// Function to check for presence of button and handle the link click
function handleLinkClick(event) {
// Check if an element with the class 'alert alert-info' contains the text 'Perfect!'
const alertElement = document.querySelector('.alert');
if ((alertElement && alertElement.textContent.includes('Perfect!')) || clickCount >= 5) {
// Allow the link to be followed
return true;
} else {
// Prevent the default link action
event.preventDefault();
// Display a popup window
alert('Please try again to complete the mixed-up puzzle first.' + "\n" + 'Remember, you can click the "Help me" button to remove an unnecessary block or combine two blocks.' + "\n" + ' You can skip the puzzle after 8 attempts.');
return false;
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
let isC8 = false;
// Override the console.log function to capture the log event
const originalConsoleLog = console.log;
console.log = function (message) {
// Call the original console.log function to ensure the message still appears in the console
originalConsoleLog.apply(console, arguments);
// Check if the message contains the specific pattern
if (message.includes('Save logging event')) {
// Extract the JSON part from the log message
const jsonString = message.substring(message.indexOf('{'));
checkActValue(jsonString);
}
};
function checkActValue(loggingEvent) {
try {
const eventObj = JSON.parse(loggingEvent);
const actValue = eventObj.act;
const lastPart = actValue.split('|').pop();
if (lastPart === "c8") {
isC8 = true;
}
console.log(`Last part of act: ${lastPart}, isC8: ${isC8}`);
} catch (error) {
console.error('Error parsing the logging event:', error);
}
}
}
// Attach the click event handler to the link
document.getElementById('ie2').addEventListener('click', handleLinkClick);
function handleLinkClick(event) {
const alertElement = document.querySelector('.alert');
if ((alertElement && alertElement.textContent.includes('Perfect!')) || isC8) {
return true;
} else {
event.preventDefault();
alert('Please try again to complete the mixed-up puzzle first.' + "\n" + 'Remember, you can click the "Help me" button to remove an unnecessary block or combine two blocks.' + "\n" + 'You can skip the puzzle after 8 attempts.');
return false;
}
}
document.addEventListener('DOMContentLoaded', () => {
// Get references to the button and the display element
const checkButton = document.getElementById('parsons-1-check');
// Add an event listener to the button
checkButton.addEventListener('click', updateClickCount);
const linkElement = document.getElementById('ie2');
if (linkElement) {
linkElement.addEventListener('click', handleLinkClick);
} else {
console.error('Element with ID "ie2" not found.');
}
});
</script>
Loading

0 comments on commit d285ecc

Please sign in to comment.