WGU D335 Intro to Programming in Python Guide

How to pass WGU D335 Introduction to Programming in Python: reading errors, debugging, small functions, original exercises, a study plan, and a free quiz.

Stuck on WGU D335 Introduction to Programming in Python? A tutor can walk you through it, one on one. Get help

Last checked: October 31, 2026. Course details come from the WGU Institutional Catalog (October 2026). Course codes and requirements can change, so confirm in your WGU course page.

To pass WGU D335, you need to write small Python programs from scratch, not just read them. It ends with an objective assessment on control flow, functions, and modules. Practice by typing code each day, reading your error messages, and testing little functions until you can solve new problems on your own.

Want to test yourself first? Take the free D335 Python practice quiz.

D335 is where many WGU students write their first real Python code. If you’ve never programmed before, that’s okay. Python is one of the most beginner-friendly languages, and the key is practice, not memorization.

WGU D335 at a glance

Course codeD335
Course nameIntroduction to Programming in Python
Competency units3
Main topicsPython scripts, control flow, functions, loops, packages, modules, libraries
AssessmentObjective assessment (OA), confirmed by PassPathways. Check your course page

How does D335 work?

D335 ends with an objective assessment (OA). WGU doesn’t publish assessment types on its public pages. PassPathways has confirmed this one, but check your own course page.

The October 2026 catalog lists D335 in 1 degree program, BS Data Analytics. Most other tech degrees now list E010 Foundations of Programming (Python). WGU doesn’t say that one replaces the other, so check your degree plan.

WGU’s program guides list three competencies: creating control flow with functions and loops, creating Python scripts with basic programming concepts, and implementing code with packages, modules, and libraries.

What D335 covers

WGU’s catalog describes D335 as building skills in creating Python scripts with basic programming concepts. You learn to control the flow of a program with functions and loops, and to use packages, modules, and libraries.

Python topics to master for D335

1. Variables and data types

  • int for whole numbers, float for decimals, str for text, bool for True/False.
  • input() always returns a string. Convert with int() or float() before doing math.
  • type(x) tells you what type a value is.

2. Operators

  • / gives a float: 7 / 2 is 3.5.
  • // gives whole-number division: 7 // 2 is 3.
  • % gives the remainder: 7 % 2 is 1. Great for checking even or odd.
  • ** is a power: 2 ** 3 is 8.

3. Strings

  • Indexing starts at 0: "python"[0] is "p".
  • Slicing: "python"[1:4] is "yth". The end index isn’t included.
  • f-strings: f"Total: {total:.2f}" formats a number to 2 decimal places.
  • Useful methods: .upper(), .lower(), .strip(), .split(), .replace().

4. Control flow

  • if, elif, else choose what runs.
  • Indentation matters. Python uses it to group code.
  • Comparison: == checks equality. A single = assigns a value.

5. Loops

  • for item in list: repeats for each item.
  • for i in range(5): runs with i = 0, 1, 2, 3, 4.
  • while condition: repeats until the condition is False. Make sure something changes, or it loops forever.
  • break exits a loop. continue skips to the next pass.

6. Lists and dictionaries

  • Lists: nums = [3, 1, 2], add with .append(), length with len().
  • Dictionaries: ages = {"Ana": 30}, read with ages["Ana"], loop with .items().

7. Functions

  • Define with def name(params): and send back a value with return.
  • print() shows a value. return hands it back to the code that called the function. They’re not the same.

8. Modules and libraries

  • import math then math.sqrt(16).
  • from math import pi lets you use pi directly.
  • import random then random.randint(1, 6).

A suggested 10-day D335 study plan

This is our suggestion, not a WGU timeline. Spend most of your time typing code.

  • Day 1: Variables, types, input, and type conversion.
  • Day 2: Operators and math.
  • Day 3: Strings, slicing, f-strings.
  • Day 4: if/elif/else.
  • Day 5: for loops and range.
  • Day 6: while loops, break, continue.
  • Day 7: Lists and dictionaries.
  • Day 8: Functions and return values.
  • Day 9: Modules (math, random) and files if your course covers them.
  • Day 10: Practice problems under a timer, then retake the pre-assessment.

D335 study tips

  1. Type every example yourself. Reading code isn’t the same as writing it.
  2. Read error messages. The last line usually tells you exactly what went wrong.
  3. Watch your output format. Many programming tasks expect output to match exactly, including spaces and decimals.
  4. Test edge cases. Try 0, a negative number, or an empty string.

Common D335 mistakes

  • Forgetting to convert input() to a number.
  • Using = instead of == in a condition.
  • Off-by-one errors with range() and slicing.
  • Printing a value inside a function instead of returning it.
  • Inconsistent indentation.

Practice problems (original)

  1. What does print(17 % 5) show?
  2. What does "teamwork"[0:4] return?
  3. Write a function double(n) that returns n times 2.
  4. What does for i in range(2, 8, 2): print(i) print?

Solutions

  1. 2, the remainder of 17 ÷ 5.
  2. "team".
  3. def double(n): then on the next line, indented, return n * 2.
  4. 2, 4, 6, each on its own line. 8 isn’t included.

How do you read a Python error message?

Read from the bottom up. The last line names the error, and the lines above show where it happened.

File "tips.py", line 3, in <module>
    total = bill + "5"
TypeError: unsupported operand type(s) for +: 'int' and 'str'

This says line 3 tried to add a number and text. The fix is to convert one, such as int("5").

  • SyntaxError: Python can’t read the line. Look for a missing colon, bracket, or quote.
  • IndentationError: your spacing doesn’t match.
  • NameError: a name doesn’t exist yet, or it’s misspelled.
  • TypeError: an operation doesn’t fit those types.
  • IndexError: you’ve gone past the end of a list.
  • ValueError: the type is right, but the value isn’t, such as int("two").

How do you debug a small program?

  1. Read the error, and go to that line.
  2. Print the values just before it.
  3. Check each value’s type with print(type(x)).
  4. Test the smallest case you can.
  5. Change one thing, and run it again.

How do you write and test a small function?

Write one job per function, then call it with inputs you can check in your head.

def tip_amount(bill, percent):
    return bill * percent / 100

print(tip_amount(50, 10))   # expect 5.0
print(tip_amount(0, 20))    # expect 0.0

Try normal values first, then edge cases like zero or an empty list. If your function prints instead of returns, you can’t use the result elsewhere. That’s a common beginner slip.

Extra exercises (original)

These are about everyday tasks, so try them without looking anything up.

  1. Write is_even(n) that returns True for even numbers.
  2. Write count_vowels(word) that counts a, e, i, o, u.
  3. Write largest(numbers) that returns the biggest value in a list, without using max.
  4. Use the math module to print the square root of 81.

Exercise solutions

def is_even(n):
    return n % 2 == 0

def count_vowels(word):
    total = 0
    for letter in word.lower():
        if letter in "aeiou":
            total += 1
    return total

def largest(numbers):
    biggest = numbers[0]
    for n in numbers:
        if n > biggest:
            biggest = n
    return biggest

import math
print(math.sqrt(81))   # 9.0

If you did not pass D335

Read your score report, and find the weak area. Then write new small programs on that topic, rather than rereading. If errors stopped you, practice the reading steps above. Use the 7-day WGU retake plan, check the WGU retake policy, and talk with your instructor. See the WGU retake hub for more.

WGU D335 FAQ

Is D335 hard for beginners? It can feel hard at first because programming is a new way of thinking. Daily practice makes a big difference.

Do I need to install Python? Your course materials explain the tools to use. Many students also practice in a free online Python editor.

How do I know I’m ready? When you can solve new small problems from scratch without looking at examples. Check our WGU OA readiness checklist.

Ready to test yourself?

Take the free D335 Python practice quiz.

PassPathways is an independent resource and is not affiliated with WGU. This guide contains original explanations and practice problems, not actual exam questions.

Back to the WGU study guides.

Stuck on this course? Get one-on-one tutoring.

Tell us what you want, and we'll reply with how a tutor can help. We teach and coach. When you're ready, agree to our terms below.

Get started

Learn about WGU tutoring

Want help with WGU D335 Introduction to Programming in Python?

Reading a guide is a great start, but some topics click faster when someone explains them to you. Our tutors work one on one with WGU students.

  1. Tell us where you're stuck. Share your course and what feels hard.
  2. We reply on WhatsApp or email. No forms to wait on if you'd rather chat.
  3. A tutor explains it and builds a plan with you, so you understand the material and pass on your own.
  • Original guides, fact-checked against official WGU sources
  • Honest, ethical tutoring: we teach, you do your own work
  • Free practice quizzes to check your progress
Need help with this course? WhatsApp Message