Audit Analytics Exam 1

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/49

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:40 AM on 9/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

50 Terms

1
New cards

revenue = 15000

cogs = 40000

operating_expense = 10000


calculate gross profit, net income, and gross margin and print them

gross_profit = revenue - cogs

net_income = gross_profit - operating_expense

gross_margin = gross_profit / revenue

print(“Gross Profit:”, gross_profit)

print(”Net Income:”, net_income)

print(“Gross Margin:”, gross_margin)

2
New cards

account_name = “Accounts Receivable”

account_number = 1200

balance = 45230.75

is_active = True


check the type of each

print(type(account_name))

print(type(account_number))

print(type(balance))

print(type(is_active))

3
New cards

messy_name = “ accounts RECEIVABLE “


clean the name

cleaned_name = messy_name.strip().title()

print(cleaned_name)

4
New cards

messy_accounts = [

“ CASH “

“accounts payable”

“ INVENTORY “

“ Notes Receivable “

“prepaid EXPENSES”


clean just the first item and print it


first_account = messy_accounts[0]

cleaned_first = first_account.strip().title()

print(cleaned_first)

5
New cards

balances = [15000, 8200, 42750, 3100, 67000, 920]

find the total, max, min, and count and print it

1st way:

total_balances = aum(balances)

print(total_balances)

max_balances = max(balances)

print(max_balances)

min_balances = min(balances)

print(min_balances)

count_balances = len(balances)

print(count_balances)


2nd way:

print(“Total Balances:”, sum(balances))

print(“Max Balances:”, max(balances))

print(“Min Balances:”, min(balances))

print(“Count Balances:”, len(balances))

6
New cards

balances = [15000, 8200, 42750, 3100, 67000, 920]


define a variable equal to the total of balances and print it

total_balance = sum(balances)

print(“Total of Balance:”, total_balance)

7
New cards

balances = [15000, 8200, 42750, 3100, 67000, 920]


print the thirs and last balance without using a loop

print(“Third Balance:”, balances[2])

print(“Last Balance:”, balances[-1])

8
New cards

balances = [15000, 8200, 42750, 3100, 67000, 920]


without using a loop, write one line of code that prints:

Total of all balances: 136970, average balance: 22828.333333333333332

print(f”Total of all balances: {sum(balances)}, average balance: {sum(balances) / len(balances)}”)

9
New cards

balances = [15000, 8200, 42750, 3100, 67000, 920]


a new transaction comes in for $5,400. Add it to balances, and then recompute the total and the average

balances.append(5400) #this is the function to add

print(f “Total of all balances: {sum(balances)}, average balance: {sum(balances) / len(balances)}”)

10
New cards

balances = [15000, 8200, 42750, 3100, 67000, 920]


print the middle four values

middle_four = balances[1:5]

print(middle_four)

11
New cards

balances = [15000, 8200, 42750, 3100, 67000, 920]

add 5400 to the balances list and reprint the list

balances.append(5400)

print(balances)

12
New cards

approved_vendors = [ “Acme Corp”, “Beta LLC”, “Gamma Supplies”, “Delta Industries”]


check whether Acme Corp is in approved_vendors, and separately whether Zeta Partners is as well. print both results

print(“Acme Corp” in approved_vendors)

print(“Zeta Partners” in approved_vendors)

#it will respond with either true or false based on the “in” function

13
New cards

transaction_amount = 31000

materiality_threshold = 25000


write an if/else that prints “Above materiality threshold” or “Below materiality threshold”

if transaction_amount > materiality_threshold:

  • print(“Above materiality threshold”)

else:

  • print(“Below materiality threshold”)

#the bullet points indicates only one tab over


14
New cards

transaction_amount = 60000

  • ammount > 50000 → “High risk - requires partner review”

  • amount > 25000 → “Medium risk - requires manager review”

  • otherwise → “Low risk - standard review”


use an if/else/elif to perform the categorization


if transaction_amount > 50000:

  • print(“High risk - requires partner review”)

elif transaction_amount > 25000:

  • print(“Medium risk - requires manager review”)

else:

  • print(“Low risk - stamdard review”)


#use elif if there is another level needed to be added

#else is used when nothing else fits the description then you do this…


15
New cards

transactions = [12000, 45000, 8500, 63000, 22000, 51000, 9800]


loop through the list and print each trasnaction

for amount in transactions:

  • print(amount)

#”amount” here can be any variable


16
New cards

transactions = [12000, 45000, 8500, 63000, 22000, 51000, 9800]

materiality_threshold = 25000


print a flag message only for transactions exceeding the threshold

for amount in transactions:

  • if amount > materiality_threshold:

    • print(f “FLAGGED: ${amount} exceeds materiality threshold”)


17
New cards

write a function that returns a list of amounts exceeding the threshold ( do not print inside the function — return the values)

def flag_large_transactions(amounts, threshold):

  • flagged = []

  • for amount in amounts:

    • if amount > threshold:

      • flagged.append(amount)

  • return flagged


#the first line is the function header

second line is an empty list made to collect the amounts and check which is greater than the threshold

third line is starting the loop

fourth line is the if function

fifth line is using append rather than print it into flagged which collects it into a list rather than displaying it

sixth line just says return the completed list back out of the function so whoever is next to use the function can do so


18
New cards
19
New cards

call the flag_large_transactions function with a threshold of 25000 and 50000 and store it in result_xK and print it


then compare the two lists to see if the second list is shorter



added task: print a sentence that reports how many transactions were flagged for 25000. Ex. 3 transactions were flagged

result_25k = flag_large_transactions(transactions, 25000)

result_50k = flag_large_transactions(transactions, 50000)

print(“Flagged at $25,000 threshold:”, result_25k)

print(“Flagged at $50,000 threshold: result_50k)

print(“Second list is shorter:”, len(result_50k) > len(result_25k))



print(f “{len(result_25k)} transactions were flagged.”)

20
New cards

amounts = [12000, 58000, 31000, 9500, 47000]


print a message for any transaction that exceeds $25,000 formatted as FLAGGED: $

for amount in amounts:

  • if amounts > 25000:

    • print(f “FLAGGED: ${amount}”)


21
New cards

transaction = {“date”: “2026-01-15”, “vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”}


print the vendor, then the amount by assessing the, through their keys

print(transaction [“vendor’])

print(transaction [“amount”])

22
New cards

transaction = {“date”: “2026-01-15”, “vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”}


add a new key “invoice number” with value “INV-2031”, then update “amount” to 4750. Print the full dictionary

transaction[“invoice number”] = “INV-2031”

transaction[“amount”] = 4750


print(transaction)

23
New cards

transaction = {“date”: “2026-01-15”, “vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”, “invoice number”: “INV-2031”}


loop over keys and values by printing every key and value, one pair per line

for key, value in transaction.items():

  • print(f”{key}: {value}”)

#.items() gives you pairs, so the loop needs two variable names


24
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]

print each transaction’s vendor and amount

for t in transactions:

  • print(f “{t[“vendor”]}: ${t[“amount”]}”)


25
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


sum the total and print the total across all transactions

total = 0

for t in transactions:

  • total +- t[“amount”]


print(“Total:”, total)


26
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


for any transaction where amount > 10000, print a flagged message

for t in transactions:

  • if t[“amount”] > 10000:

    • print(f “FLAGGED: {t[“vendor’]} - ${t[“amount”]} - {t[“account”]}”)


27
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


build a dictionary “totals_by_vendor” where each key is a vendor and each value is their total spend


totals_by_vendor = {}


for t in transactions:

  • vendor = t[“vendor”]

  • amount = t[“amount”]

  • if vendor in totals_by_vendor:

    • totals_by_vendor[vendor] +- amount

  • else:

    • totals_by_vendor[vendor] = amount


print(totals_by_vendor)


28
New cards

Using totals by vendor, find and print which vendor has the highest total spend

top_vendor = None

top_amount = 0


for vendor, amount in totals_by_vendor.items()

  • if amount > top_amount:

    • top_amount = amount

    • top_vendor = vendor


print(f “Top Vendor: {top_vendor} ${top_amount}”)


29
New cards

how to build a dataframe

import padas as pd

30
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


build a dataframe

import padas as pd

df = pd.DataFrame(transactions)

df

31
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


look at the dataframe 3 ways

print(df.head())

print(df.info())

print(df.describe())

32
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


select one column, in this case “amount” and then print its type

print(df[“amount”])

print(type(df[“amount”]))

33
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


on the amount column, print the sum, mean, and max

print(“Sum:”, df[“amount'“].sum())

print(“Mean:'“, df[“amount].mean())

print(“Max:”, df[“amount”].max())

34
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


print a boolean mask with amount > 10000

print(df[“amount”] > 10000)

35
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


create a variable flagged containing only rows where amount exceeds 10000

flagged = df[df[“amount”] > 10000]

flagged

36
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


Create a variable “travel” containing only the rows where acount equals travel

travel = df[df[“account”] == “Travel”]

travel

37
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


Create a variable “equipment_flagged” containing only the rows where amount is over 10000 and account equals equipment

equipment_flagged = df[(df[“amount”] > 10000) & (df[“account”] == “Equipment”)]

equipment_flagged

38
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


Group df by vendor and sum the amount column. Store the result in totals_by_vendor and print it

totals_by_vendor = df.groupby(“vendor”)[“amount”].sum()

print(totals_by_vendor)

39
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


print totals_by_vendor[“Acme Corp”], then print the type

print(totals_by_vendor[“Acme Corp”])

print(type(totals_by_vendor))

40
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


use .value_counts on the vendor column to count how many transactions each vendor has. Store it in counts_by_vendor and print it

counts_by_vendor = df[“vendor”].value_counts()

print(counts_by_vendor)

41
New cards

transactions = [

{“vendor”: “Acme Corp”, “amount”: 4500, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: 800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: 15500, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]

find the top vendor with the highest total and tha total’s value

top_vendor = totals_by_vendor.idmax()

top_amount = totals_by_vendor.max()

print(f “Top vendor: {top_vendor} (${top_amount})”)

42
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


import, create dataframe, then print info

import pandas as pd

df = pd.DataFrame(raw_transactions)

df.info()

43
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]

clean the amount column and print it as a list

cleaned = df[“amount”].str.replace(“$”, ““, regex=False).str.replace(“,”, ““, regex=False)

print(cleaned.tolist())

44
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


convert the real numbers and put the column back

df[“amount”] = pd.to_numeric(cleaned, errors = “coerce”)

df.info()

45
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


Handle the missing value

print(“Missing amounts:”, df[“amount”].isna().sum()) #this gives you a sentence

df[df[“amount”].isna()] #this gives you the chart

46
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


drop the rows with no amount

df = df.dropna(subset = [“amount”])

print(df)

print(“Rows now:”, len(df))

47
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


print the vendors value counts. and then clean the vendor

print(df[“vendor”].value_counts()


df[“vendor”] = df[“vendor”].str.strip().str.title()

print(df[“vendor”].value_counts()

48
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]

remove duplicate rows

print(“Duplicate rows:”, df.duplicated().sum()

df[df.duplicated(keep = False)]

49
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


drop duplicate rows

df = df.drop_duplicates()

print(“Rows now:”, len(df)

50
New cards

raw_transactions = [

{“vendor”: “Acme Corp”, “amount”: $4,500.00, “account”: “Office Supplies”},

{“vendor”: “Acme Corp”, “amount”: 12000, “account”: “Office Supplies”},

{“vendor”: “Beta LLC”, “amount”: $800, “account”: “Travel”},

{“vendor”: “Gamma Supplies”, “amount”: None, “account”: “Equipment”},

{“vendor”: Beta LLC”, “amount”: 2200, “account”: “Travel”}

]


convert the dates then group by the vendor and sum the amount on the cleaned data

df[“date”] = pd.to_datetime(df]”date”])

df.info()

print(“latest transactions:”, df[“date”].max())


totals_by_vendor = df.groupby(“vendor”)[“amount”].sum()

print(totals_by_vendor)