Tag Archives: python

NEW! TechnoPython – Python Lessons for Beginners

Do you need Python lessons for beginners? If yes, then you will be happy to learn more about TechnoPython. It is a new programming technology project from TechnoKids. This curriculum resource includes coding activities that are ideal for middle school and high school students.

In TechnoPython, your students become game developers. They learn the Python programming language by building games such as Pet Monster Rescue, Guess It, and Adventure Quest. To conclude the curriculum unit, students share their favorite Python program in a coding presentation.

Not only do the Python lessons teach fundamental programming concepts, but they also spark an interest in computer science. At the same time, the assignments develop soft skills that are highly valued in a programmer, such as curiosity, logical thinking, persistence, and creativity.

TechnoPython has Python lessons for beginners,

Complete Python Programming Missions

In TechnoPython, students learn the Python programming language by completing programming missions. Each mission begins with the basics and then advances to more complex tasks. With this in mind, you can assign one mission or do them all! In fact, TechnoPython offers so much flexibility, you can use the lessons as part of computer science class, programming unit, Python workshop series, or for an Hour of Code.

Coding Jungle Programming Mission

The goal of the Coding Jungle Mission is to gain an understanding of the Python programming language. The mission has four tasks. To start, students experiment with code to learn about the role of a programmer and about terminology. Next, they play the Python Hunt game and edit the program to discover how it works. Afterwards, they develop debugging skills by adding “bugs” or mistakes to the Catch the Bugs game. These assignments are ideal for beginners.

Coding Jungle Mission
Introduce the Python programming language to beginners in the Coding Jungle mission.

Pet Monster Rescue Programming Mission

In the Pet Monster Rescue Mission, students design a program that matches an owner to their ideal pet. The mission has four tasks. First, students learn about strings, integers, and variables so that they understand how to write text and ask questions. Next, they apply this programming knowledge to inform others about the adoption process. Afterwards, they complete a flowchart that outlines the logic needed to match a person to a pet. Finally, they build the decision-making code that determines if a pet with horns, scales, one eye, or many arms is a good fit. This is done by writing if and else statements that use logical operators. These Python lessons for beginners include extra challenges to improve the program and make it unique.

Pet Monster Rescue
Write if statements using logical operators to match a person to their ideal pet.

Guess It Programming Mission

In the Guess It Mission, students build a guessing game. It asks players to guess a number correctly before they run out of chances. Clues tell the player if their answer is too high or low. Coding challenges help students to enhance the game design. They can format the output, create a cheer, keep score, or switch player feedback. This programming mission has six tasks. Programmers combine the random library, loops, and conditionals to build a fun game that players will want to play again and again.

Guess It Mission
Build a guessing game using Python lessons for beginners.

Adventure Quest Programming Mission

In the Adventure Quest Mission, students create a text-based adventure game. It has players explore a strange land to earn coins and collect special objects. The programming mission has nine tasks. To prepare, students learn how to control data entry. This will prevent typing errors from causing bugs. Next, they describe the places players visit when they travel North, South, East and West using functions. To add interest to the storyline, they then apply their programming skills to create a game that has the player pick the correct color to win money.

Game development continues with a treasure hunt. Players travel East to collect objects and store them in a backpack. To prepare for this part of the programming mission, students learn how to add, remove, sort, and count list items. Once this skill is mastered, they create an adventure with loot and hidden dangers. Will the players find treasure or risk losing it all?

Python lessons for beginners
Design a text-based adventure game using the Python programming language.

Teach Programming Skills to Middle and High School Students

Is student engagement important to you? If yes, then TechnoPython is a great way to start teaching the Python programming language. Instead of having students mindlessly copy code snippets, they build unique games. In other words, everyone follows the SAME instructions, but each person creates an original program!

Teach essential programming skills using Python lessons for beginners:

  • build an algorithm using a flowchart that describes the steps in a program
  • write Python code to achieve a specific goal
  • apply debugging techniques to identify and fix errors
  • format the output of program to make it easy to read
  • collaborate with others to review program design
  • name a variable and assign a value
  • prompt the user to input a value for a variable
  • convert a variable from an integer to a string or vice versa
  • manipulate the case of a string to upper, lower, or sentence case
  • calculate the values of variables
  • create an editable list of items; add, remove, sort and count items
  • loop a set of instructions forever or until a condition is met
  • repeat a set of instructions a specific number of times
  • break a loop to stop running a set of instructions
  • control the outcome using if, elif, and else statements
  • trigger actions using logical operators (==, !=, <, >) and True/False values
  • develop a function to run a block of instructions
  • import Python libraries
  • select a random integer or choice

Python Lessons for Beginners

Are you teaching programming to kids? It should be noted, TechnoPython is jam-packed full of Python programming activities. The technology project has:

  • 24 Python Assignments: The TechnoPython assignments are divided into sessions. In each session students complete a programming mission. The assignments have detailed steps, troubleshooting tips, and coding challenges. By following the instructions, students gradually learn how to independently plan, write, and debug original programs.
  • 8 Extension Activities: The extension activities are additional assignments for enrichment. They present a wide range of learning opportunities. Some are programming tasks that introduce a new skill while others are reflections about the coding experience.

What Do I Get with the TechnoPython Technology Project?

Do you want to save time designing your own lessons? TechnoPython has everything you need to teach a computer science unit or hands-on programming workshop:

  • TechnoPython Teacher Guide: The teacher guide has six sessions. It has lessons for teaching each programming mission. As well it includes preparatory steps, teaching strategies, and learning objectives. It also has simple explanations of code snippets to help explain how a program works to children ages 10 and up.
  • TechnoPython Student Workbook: The student workbook is a complete booklet of assignments. This file is in PDF format. Use it to double-side print. Place the instructions into a binder or duo-tang for distribution to students.
  • TechnoPython Student Worksheets: The assignments are available as individual worksheets. These files are in a secure PDF format and require Adobe Reader or Kami to view and annotate. Import these worksheets into an LMS such as Google Classroom or Canvas to create assignments.
  • TechnoPython Resources: TechnoPython includes a folder that has customizable assessment tools, task lists, certificates, templates, and samples.

Simplify Teaching with the TechnoPython Resources

  • 6 Python Reviews: The reviews are quizzes. Questions are true/false, fill-in-the blank, or multiple choice. They assess students understanding of programming terminology, Python commands, or computer science concepts. These files are in a customizable Word/Docs format allowing teachers to add or remove questions.
  • 5 Python Skill Reviews: The skill reviews are additional assignments to solidify learning. They encourage the transfer of knowledge to a new task. Many of the skill reviews in TechnoPython require students to enhance the program built in the session. These files are in a customizable Word/Docs format making it possible for teachers to edit the content.
  • 3 Python Peer Reviews: The peer reviews are question sheets that have students play each other’s games and then provide feedback. They are an excellent way to promote collaboration and celebrate learning.
  • Game Marking Sheets: Each game built using Python has a marking sheet. There is one for Pet Monster Rescue, Guess It, and Adventure Quest. These files are in a customizable Word/Docs format so that teachers can adjust the scoring or criteria.
Quest Task List
Track programming mission progress using a task list that looks like a gameboard.
  • Python Task Lists: The task lists are gameboards with an outline of each part of the programming mission. Students can use them for self-monitoring or to recognize accomplishments. These are available as customizable Word/Docs files, allowing teachers to modify the programming mission.
  • Programming Mission Certificates: Each programming mission has its own certificate to recognize student achievement. These are available as customizable PowerPoint/Slides files. This allows teachers to customize the award by adding the student name or a school logo.
  • Programming Templates: The programming templates are used at the beginning of the TechnoPython technology project. They introduce Python to beginners. Students open the Python file and follow instructions to edit the content.
  • Over 30 Python Program Samples: Every program that students build has an accompanying sample file. These Python files can be used for demonstration purposes to explain the task or inspire learners. They also provide an answer key. For example, all coding challenges have solutions.

Contact TechnoKids to Learn More about TechnoPython

To get started teaching the Python programming language contact TechnoKids today or get TechnoPython right now!

Python Debugging Strategies for Beginners

Explicitly teaching Python debugging strategies provides students with a toolkit of techniques. The same debugging strategy cannot be applied to every problem. Provide students with a multitude of strategies and explain when they are most effective. This will enable programmers to thoughtfully debug their programs using a toolkit full of techniques.

10 Python Debugging Strategies for Beginners

Do not wait until the end of a programming unit to teach Python debugging strategies. Instead, help students find and fix bugs. Below are 10 techniques that will build confidence and independence in your students. They are based on using IDLE Python to write code. Many of these strategies are included in the Python project TechnoTurtle for elementary and middle school students.

1. Look Before Highlighted Word to Find Syntax Errors

Syntax is the set of rules for how to order words and use symbols to write code. If a bracket, colon, or indentation is missing the IDLE Python program will show a Syntax Error box on the screen to identify the problem. It will also highlight a word to pinpoint the location.

Do not be fooled! The problem is not the highlighted word. Instead the mistake is BEFORE it. Look at the words just in front of the highlighting, or the line of code above to find the error.

Syntax errors are often typos. Missing commas, hashtags, or too many brackets are common. If that isn’t the issue, study the order of the words as they might be put together wrong.

Python debugging strategies

Explicitly teaching Python debugging strategies. A Syntax Error is often missing symbols such as a colon, comma, or hashtag. Tell young programmers to look before the highlighted word.

2. Indent a Block of Instructions the Same Number of Spaces

Instructions that loop or run when a condition is met, are grouped together by indenting the lines of code to form a block. For example:

# correct way to make a loop
if answer==”tiger”:
    print(“You are right.”)
    print(“You win!”)

# wrong way to make a loop
if answer==”tiger”:
print(“You are right.”)
print(“You win!”)

When the code is not written correctly, IDLE Python will show a Syntax Error that states, “expected an indented block”. When this happens, check to see if the first line ends with a colon. If it does, then verify that each instruction in the block indents the same number of spaces.

3. Skim and Scan the Error Message to Find Clues

IDLE Python will display an error message in the Python Shell. It is in red text. To a novice, it can seem like gibberish. The best thing to do, is to scan the text for familiar words. Look for the line number. This will tell you where the error happened. To quickly go there within the program, right click the line number and select Go to file/line.

Before you view the line of code, study the bottom of the error message for more clues. It may say NameError at the bottom. If it does notice if the word is spelled correctly. If it is then check to see if a library was not imported or a variable was not defined properly.

Python error messages

Scan the message for clues. Look for the line number. Go to the last line to see if a function is spelled wrong. If it is right, you may have forgotten to import a library.

4. Look at the Color Coding

IDLE Python applies a color theme to text. This makes types of Python words different colors. This can be helpful when trying to find mistakes. Here are some helpful Python debugging strategies for beginners:

  • Comments are red. If a comment is not red, it is likely missing a # at the beginning, such as #this is a comment.
  • Strings are green. If a string is not green, it is likely missing quotes around it. Or, if a bracket is green, it likely that the end quote is missing.

Python color coding

Use color coding as a clue to find and fix errors.

5. Apply Trial and Error

A proven Python debugging strategy is Trial and Error. Trial and Error is a method of testing different ideas until one is found that works the best. The programmer will run their program and then study the output. They will notice the things that are wrong or unexpected. This analysis allows them to come up with a better idea to try next.

Trial and Error is systematic. The programmer only tries one idea at a time. This way they can pinpoint what is most effective.

Trial and Error is best applied when a programmer is fine-tuning the output. Their code has no syntax or naming errors. Instead, the focus is on discovering the ideal value or sequence of instructions to achieve the goal.

6. Code One Line at a Time

This Python debugging strategy can be used while writing a program or after it is written. When programming, type a line of code at a time and then run the program to test it. This allows you to quickly identify if there are typing errors or an issue with the sequence of instructions. This makes mistakes easier to spot.

Once a program is written, if you cannot find the mistake, divide the code into parts. Copy a chunk at a time into a new program. Run it to see it that section is error free. If it is, add another chunk of code to the program. Continue until you find where things are broken. Now you can focus your attention on that area.

7. Compare Using a Similar Model

If you cannot figure out what is wrong with the code and everything seems right, another Python debugging strategy is to find a similar program. Study the code to notice how it is constructed. This can provide a clue as to why the code is not working properly.

8. Copy and Paste from a Working Program

If you cannot debug the code and you are getting desperate, refer back to your previous work. Use existing code that is error-free as a jumping-off point. Copy a snippet of code that does a similar task from an existing program and paste it into the current file. Adjust the values or text to suit your programming objectives.

9. Enlarge the Font Size to Make the Code Easier to Read

When you have been programming for a long time the text can blur together. To make the lines of code sharper you can increase the font size or change the typeface to something that is easier to read. Now typos might be easier to spot. To do this:

  1. From the IDLE Editor Window, select the Options menu.
  2. Select Configure IDLE
  3. Click the Fonts/Tabs.
  4. Pick a font face such as Arial.
  5. Near the bottom pick a size such as 14.
  6. Click OK.
  7. Click the X to close the window.

IDLE Python options

Increase the font size and change the font to make bugs easier to spot.

10. Ask a Peer for Help

If you cannot find the error ask a friend for help. Often a fresh set of eyes can easily spot the typo in a line of code that has been looked over a hundred times. If the problem is related to the output, explain what you want the code to do. Look at the code together. Describe what is going right, and pinpoint where things start to go wrong. Run the program and study the outcome. Work together to discover a solution.

Python Debugging Strategies Support Learning

Make time to teach Python debugging strategies. Understanding how to code should not be restricted to those with a natural ability. Instead, provide your students with a toolkit of techniques they can use to find and fix errors. This will develop a positive attitude towards programming, build confidence, and promote independence.

Reasons To Explicitly Teach Debugging Strategies in Python

Teach debugging strategies to beginners. This will enhance the learning experience. The instruction should be evident and apparent to the students. Instead of hoping that young programmers will discover techniques, guide them through proven methods to find and fix errors.

Teach Debugging Strategies

Teach debugging strategies to promote independence, build confidence, and spark a life-long interest in programming.

10 Reasons to Teach Debugging Strategies

There are many benefits to deliberately teaching debugging strategies at the start of a programming unit:

1. Improve Comprehension

Teaching debugging strategies to beginners allows them to make sense of the Python programming language. Similar to reading comprehension, explicit strategy instruction, gives student the skills they need understand text. They learn how to decode the meaning of the error messages and apply techniques to correct the code.

2. Promote Independence

Guiding students through exercises where they break and then repair the code, promotes independent practice. During the activity, young programmers receive instant feedback about what makes code work. This allows them to take control of their own learning.

3. Develop a Deeper Understanding of Code

Young kids are always asking “Why?” As they grow older, they may not ask the question aloud as often but they continue to wonder about their world. When they are taught debugging strategies they begin to form connections to why a line of code must be written in a particular way. They understand the purpose for quotes, brackets, indents, and hashtags. Ultimately, this makes them better programmers.

4. Build Confidence

Young programmers can quickly become discouraged when their programs do not run. In the IDLE Python environment mistakes are highlighted in red with boxes that tell you instantly there is an error. This information on the screen is helpful if a learner knows how to apply it to correct the problem. However, if the meaning of the errors are unknown then they look like gibberish. Instead of having students struggle and give up, teach them strategies they can use to find and fix errors. Each success will build confidence.

5. Encourage a Positive Attitude Towards Programming

One of the goals to teaching programming to elementary and middle school students is to spark an interest in STEM. To ignite a passion for coding, the experience should be fun. Glaring at an error message with no idea how to fix the problem is not enjoyable. In fact, if it goes on too long it can make a novice dislike programming. Teaching students about common errors is empowering. They can make their programs run and see the results of their efforts, which is a great feeling.

6. Establish a Toolkit of Programming Techniques

The same debugging strategy cannot be applied to every problem. For example, Trial and Error is a wonderful way to test ideas. However, it can be inefficient when the issue is a loop missing indented instructions. Provide students with a multitude of strategies and explain when they are most effective. This will enable programmers to thoughtfully debug their programs using a toolkit full of techniques.

7. Reshape How Mistakes How Perceived

Children often believe that mistakes are “bad”. They don’t want their work to be imperfect. Teaching debugging strategies allows students to rethink mistakes. They become teaching tools that promote learning. Also, they enforce that not everything is wrong in the program. Instead only one thing is not quite right. The debugging technique of Trial and Error is an excellent way to celebrate mistakes. Students can experiment with different values or move a line of code to discover how it changes the output. The process of testing an idea and then studying the outcome is one way to put a positive spin on errors.

8. Make Programming Accessible to Everyone

Teaching debugging strategies makes programming attainable for everyone in the class. Success is not limited to only those students who have a natural ability. Instead, beginners can make original creations because they understand how to improve their code.

9. Avoid Classroom Management Problems

It is challenging for a teacher to help a class full of students struggling with the errors in their programs. As frustration levels grow, learners can quickly become disengaged. This can result in behavioral issues as they express how they are feeling. By knowing some simple but effective debugging strategies, students build the skills and confidence they need to troubleshoot code independently.

10. Provide a Foundation for Future Learning

Teaching debugging strategies is a great way to promote a life-long interest in programming. By successfully building programs, young programmers will want to make even more. They will be able to transfer their skills to more complicated programming tasks. Getting over the obstacles to learning at the start of a coding unit invites the possibility that students will continue to code in the future.

Python Lessons for Beginners

TechnoTurtle has programming activities that use explicit strategy instruction to teach debugging strategies. Students are guided through editing Python scripts to find and fix common errors. This provides a foundation for creating their own unique programs.

To learn more about TechnoTurtle, visit TechnoKids.

Variables in Python and Teaching Coding to Kids

Variables in Python are used by programmers to store values. These values complete a task within a program. In game design variables can track scores, count the number of turns, or store player answers. However, they have many other uses. When teaching coding to kids, it is important that the purpose of a variable is understood.

variables in python

Variables in Python store values that a program uses to complete a task.

What Are Variables in Python?

A variable stores a value that can change. It is saved in a special spot that is like a numbered storage bin. When the program needs the value in the variable it takes it from the bin.

A variable can store lots of different types of information. For example, the value could be a number, text, or a list of items. In programming, a number is called an integer or int for short. Text is called a string or str for short.

A variable has two parts – name and value. To create a variable, you write the variable name, then an = symbol, followed by the variable value. For example: player=”Alex”

variable name and value

A variable has two parts – name and value.

Variables in Python Must Have Meaningful Names

Naming a variable is a fundamental skill. A programmer should be able to read the variable name and understand its use within the program. It is very important that it is short but concise. It’s name should describe its purpose.

A Python variable must:

  • be meaningful
  • be one word
  • have no spaces
  • use no symbols
  • not be a reserved Python word

Why Use a Variable?

Variables make a program flexible. Programmers use them for many reasons.

Variables Can Count the Number of Times an Event Occurs

Variables can count. This is useful when making a timer or tracking a player’s score. To count, you can create a variable called count=0. Each time the line of code count=count+1 is run than the value of the variable goes up by one.

Variables Can Store Multiple Values as a List

Variables can store more than one value. The list may look like this: pickcolor=(“red”, “blue”, “green”). By assigning multiple values to a variable it allows a program to make a choice. This use of variables creates games that are fun to play because the selection is unknown.

Variables Allow the User to Input Information

Sometimes the programmer assigns the value of a variable. Other times, the user inputs a value. This is done by prompting the user to enter data by displaying a text box or question on the screen. For example, the following code will store a user’s name:
name=input(“What is your name?”)

Variables Report Information

By using the variable name in a sentence you can report important information to the user. For instance, to display a player’s score the following code will join text with the variable value:
print(“The game is over. Your score is ” +str(score)).

Variables Personalize the User’s Experience

Variables can be used to communicate, making a device seem more human or less machine-like. Suppose that a player types in their name. Lines of code can have the computer give a personal greeting, such as Hello Sara. The sentence and variable are put together using this Python code: print(“Hello ” +str(player)).

Variables Can Trigger an Action

A variable’s value can change. If it is a number, it can get higher or lower. If it is a text, it could have another value assigned to it. Conditional logic can be used to trigger an action when a variable meets a specific condition. The value of the variable might need to be equal to, greater than, less than, or does not equal. When the variable value matches the condition, then an action will occur. The code might start like this if guess==”answer”:

Variables Calculate Amounts

Variables can be used in mathematical formulas. This has many practical applications. For example, a business owner can track employee earnings. The variables wage, hours_worked, and earnings can be placed into the formula earnings=wage*hours_worked.

Create Artwork and Build Games using Variables in Python to Teach Coding

Learning how to use variables in Python can be fun. In TechnoTurtle, the programming activities gradually introduce elementary and middle school students to variables. In this project they use variables to count loops and create spirographs that are random colors. As well, they store player answers to build a Mad Lib word game, a carnival game that awards a prize, and a guessing game. These programming tasks make the purpose of a variable easy to understand. Beginners experience first-hand how variables are used in a program to complete a task.

technoturtle and variables

Learning about variables can be fun.