Build a Python Business Card
Create a Python business card while exploring variables and basic data types.
Introduction
30 Second Summary
A single changed detail can leave a profile full of mismatched information. Keeping each fact in one named place makes updates easier to trust.
In this project, you will build a terminal-style personal business card with Python. The IDLE Shell will reveal each variable's data type before it prints the updated card.
What You'll Build
When you run business_card.py, you'll see a type report followed by a personal business card with updated details for a fictional freelancer.
By the end of this project, you'll have:
- A type report that identifies str, int, float, plus bool values before the card appears.
- A finished business card that shows every saved detail on a labeled line.
- Proof that you can diagnose a mixed-type error. You will fix it with conversion plus formatted strings.
- Secret Mission: Calculate a discounted introductory rate from an integer discount applied to a decimal rate. Predict the result's data type before checking it in Python.
Are there any prerequisites?
You need a Mac plus administrator credentials if Python must be installed. No programming experience is required because the project guides you through setting up Python 3.15.0 with IDLE.
Before We Start
This checkpoint connects every line of your Python personal business card to the variables you are learning. You will use variables to store str, int, float, and bool values.
Set Up Python and IDLE
Your personal business card needs Python to execute each line. IDLE gives you an editor plus an interactive Shell.
This step confirms version 3.15.0 on your Mac. You will finish by printing a readiness message in IDLE.
In this step, get ready to:
- Check whether Python 3.15.0 plus IDLE are already available.
- Install Python 3.15.0 when needed.
- Run a visible readiness check in the IDLE Shell.
Check the Mac for Python
The official macOS installation keeps Python plus IDLE in /Applications/Python 3.15/. Checking that location reveals whether your Mac already has the required version.
Why IDLE for this project?
IDLE keeps the script editor plus its output Shell in one tool.
A separate editor would add setup outside the goal of learning variables plus data types.
- Click the Finder icon in the Dock.
- Select Applications in the Finder sidebar.
- Look for the Python 3.15 folder.
- Open the folder if it exists.
- Double-click IDLE if it is listed.
- Read the IDLE title bar if a window opens.
✔️ I see the required version
Good news. Your Mac already has Python 3.15.0 plus the matching IDLE installation.
- Keep the IDLE Shell open for the version check below.
ⓧ I see an older version
The older version does not meet this project's version requirement. Install Python 3.15.0 from the official macOS download page.
- Open Python's macOS downloads page in your browser.
- Choose the Python 3.15.0 macOS installer.
- Select Downloads in the Finder sidebar.
- Open the downloaded package.
- Click Continue in the macOS Installer.
- Click Agree to accept the license.
- Click Install to begin the installation.
macOS requests administrator credentials so the installer can add Python to Applications.
- Enter your Mac administrator credentials when macOS asks for approval.
- Wait for the installation to finish.
The completed installation places the required Python folder inside Applications.
- Return to Finder.
- Select Applications in the Finder sidebar.
- Open the Python 3.15 folder.
- Double-click Install Certificates.command.
- Wait for the temporary Terminal window to finish.
You should see Successfully installed certifi followed by update complete.
- Close the temporary Terminal window.
- Double-click IDLE in the Python 3.15 folder.
ⓧ Python is not installed
Your Mac needs the official Python 3.15.0 package. This package also installs IDLE.
- Open Python's macOS downloads page in your browser.
- Choose the Python 3.15.0 macOS installer.
- Select Downloads in the Finder sidebar.
- Open the downloaded package.
- Click Continue in the macOS Installer.
- Click Agree to accept the license.
- Click Install to begin the installation.
macOS requests administrator credentials so the installer can add Python to Applications.
- Enter your Mac administrator credentials when macOS asks for approval.
- Wait for the installation to finish.
The completed installation places Python plus IDLE inside Applications.
- Return to Finder.
- Select Applications in the Finder sidebar.
- Open the Python 3.15 folder.
- Double-click Install Certificates.command.
- Wait for the temporary Terminal window to finish.
You should see Successfully installed certifi followed by update complete.
- Close the temporary Terminal window.
- Double-click IDLE in the Python 3.15 folder.
Installation did not finish?
Confirm that you downloaded the macOS installer from the official Python page. Make sure your administrator credentials are accepted by macOS.
If certificate setup does not reach its two completion messages, check that your Mac has an internet connection.
Ask for help with the installer or certificate step.
Confirm the Python and IDLE version
Every setup path now leads to an open IDLE Shell. Its title bar identifies the Python version running that window.
- Read the version shown in the IDLE title bar.
- Confirm that the title bar shows Python 3.15.0.
- Locate the >>> prompt in the Shell.
The title bar should show version 3.15.0. The Shell should show a >>> prompt ready for a statement.
Still seeing an older version?
You may have opened IDLE from an older Python folder. Close that window before returning to /Applications/Python 3.15/.
Open IDLE from that folder before checking the title bar again.
Help me open IDLE with the required Python version.
Verify the IDLE Shell with visible output
The >>> prompt accepts a Python statement for immediate execution. A printed message proves that the interpreter can run your code.
Before you run the check, what message do you expect Python to show beneath the prompt?
- Submit a readiness message by entering this statement at the prompt and pressing Return:
print("Business Card Lab ready")
What does this code do?
- The print() function sends a value to the Shell.
- The quoted text supplies the readiness message.
- Visible output confirms that Python executed the statement.
You should see Business Card Lab ready beneath the statement. Your Python workspace can now execute code in IDLE.
No readiness message?
Make sure your cursor is on the line beginning with >>>. Retype the statement with matching double quotation marks.
Help me run the readiness statement in IDLE.
Your Python workspace is ready. Next up, you will save the first version of your personal business card.
Build a Text-Only Business Card
Your Python 3.15.0 setup is ready. IDLE has already proved that it can execute a statement.
A two-variable card creates an immediate visible result before additional data types make the program more demanding. The script displays two text values through named variables.
In this step, get ready to:
- Save a new IDLE editor file as business_card.py.
- Store the card details in two string variables.
- Display the finished text-only card in the IDLE Shell.
Create and save the project file
A saved script gives your work a permanent home. IDLE uses an editor window for the code that the Shell executes.
- In the IDLE Shell menu bar, click File.
- Select New File to open an editor window.
- In the editor menu bar, click File.
- Select Save As….
- Use the save dialog to choose your Desktop.
- Enter business_card.py as the filename.
- Click Save.
You should see business_card.py in the editor title bar. This confirms that your project file exists on your Desktop.
Store the card's text in variables
A variable assignment connects a reusable name to a value. Quotation marks tell Python to store each business detail as text with the str type.
- Add the two business details to business_card.py by entering this code:
full_name = "Alex Morgan"
professional_title = "Freelance Web Designer"
What does this code do?
- The full_name variable stores the freelancer's name.
- The professional_title variable stores the freelancer's role.
- The quotation marks make both values strings with the str type.
- Select Save from the File menu for business_card.py.
- Confirm that both assignment lines remain visible in the editor.
Assignments Not Matching?
- Compare the variable names with full_name and professional_title.
- Check that each text value has one double quote at both ends.
Ask for help comparing the assignments in your file.
Display the business card
Printing turns the stored values into visible output. The labeled lines read from the variables each time you run the saved script.
- Place your cursor below the professional_title assignment.
- Add the visible card output by entering this code:
print("PERSONAL BUSINESS CARD")
print("======================")
print(f"Name: {full_name}")
print(f"Title: {professional_title}")
print("======================")
What does this code do?
- The first two print statements create the card heading and its top border.
- The labeled print statements display the values stored in full_name and professional_title.
- The final print statement closes the card with a matching border.
- Select Save from the File menu for business_card.py.
Before you run the module, what name and professional title do you expect the Shell to display?
- Click Run in the editor menu bar.
- Select Run Module.
What Should I See?
The Shell restarts when IDLE runs the module. You should see PERSONAL BUSINESS CARD at the top.
The Name: line displays Alex Morgan. The Title: line displays Freelance Web Designer.
The ====================== border appears above and below the details.
You now have a working text-only business card that reruns from its saved file.
Card Not Appearing in the Shell?
- Return to the editor if the Shell still shows only the readiness message.
- Select Run Module from the Run menu.
- Compare every parenthesis and quotation mark with the code above.
Ask for help finding why the card is missing.
✔️ Awesome, I've got everything!
Great. Double-check that business_card.py is saved with the working card output.
ⓧ I'd like to double check the full code
Here is the complete business_card.py file. Compare it character by character with yours:
full_name = "Alex Morgan"
professional_title = "Freelance Web Designer"
print("PERSONAL BUSINESS CARD")
print("======================")
print(f"Name: {full_name}")
print(f"Title: {professional_title}")
print("======================")
Your text-only business card now runs from IDLE. Next, you will give it numbers and a true-or-false value.
Inspect Basic Data Types
Your text-only card already proves that variables can hold reusable text. Business details also include whole numbers, decimal numbers, and truth values.
This step uses Python data types to expose those differences. You will use IDLE to inspect every value before deliberately combining incompatible types.
In this step, get ready to:
- Store three new business details as integer, float, and Boolean values.
- Inspect every variable with type().
- Trigger a mixed-type error and identify the incompatible values.
Add three non-string variables
An integer represents a whole number. A float represents a number with a fractional part. A Boolean represents one of two truth values.
- In business_card.py, select the first two assignment lines.
- Replace the selected lines by pasting the code below:
# Store the original business details in variables.
full_name = "Alex Morgan"
professional_title = "Freelance Web Designer"
years_experience = 2
hourly_rate = 45.0
available_for_work = True
What Do These Values Store?
- The years_experience variable stores the whole number 2 as an int.
- The hourly_rate variable stores 45.0 as a float.
- The available_for_work variable stores True as a bool.
- Save business_card.py from the File menu.
- Select Run Module from the Run menu.
Good progress. The Shell displays your original card without an error, which proves Python accepted all five assignments.
Module Stops Before the Card?
Check that each variable name uses underscores exactly as shown. Confirm that Alex Morgan and Freelance Web Designer remain inside double quotes.
Check that True starts with a capital letter.
Ask for help with the assignment lines.
Inspect every stored value
The type() function returns the type of an object. A compact report lets you compare every business value in one run.
- In business_card.py, select the existing card output from print("PERSONAL BUSINESS CARD") through the final print("======================").
- Replace the selected output with the type report below:
# Display the type stored in each variable.
print("VARIABLE TYPES")
print("full_name:", type(full_name))
print("professional_title:", type(professional_title))
print("years_experience:", type(years_experience))
print("hourly_rate:", type(hourly_rate))
print("available_for_work:", type(available_for_work))
print()
What Does This Report Do?
- Each label identifies the variable being inspected.
- Each type() call asks Python which data type the variable currently stores.
- The final print() adds a blank line after the report.
- Save business_card.py.
Before you run the module, which variables do you expect Python to identify as str, int, float, and bool?
- Select Run Module from the Run menu.
You should see a report for all five variables. The results include str, int, float, and bool.
Missing a Type Result?
Compare each print() line with the variable assignments at the top of business_card.py. A spelling mismatch prevents Python from finding the intended variable.
Ask for help with the type report.
Trigger the mixed-type obstacle
String concatenation uses + to join pieces of text. The next expression places the int value from years_experience between two str values.
- In business_card.py, locate the final blank-output line.
- Confirm that the line matches this reference:
print()
Why Use This Line as the Anchor?
This print() line marks the end of the type report. Placing the next expression below it keeps the report visible before Python evaluates the new line.
- Place your cursor on a blank line directly below print().
- Add the mixed-type expression by pasting this line:
print("Experience: " + years_experience + " years")
What Is This Line Testing?
This line asks print() to display an experience sentence assembled with +. The middle value comes directly from years_experience.
- Save business_card.py.
Before you run the module, do you think Python will automatically combine the integer with the surrounding text?
- Select Run Module from the Run menu.
You should see all five type reports before execution stops at the Experience line. The final traceback line reads TypeError: can only concatenate str (not "int") to str.
That failure is intentional. You have proven that string concatenation cannot directly combine the str values with the int value.
What Did the TypeError Reveal?
The + operator tries to concatenate the values as text. Python stops because years_experience still contains the integer 2.
This boundary protects your program from silently treating unlike data types as interchangeable.
Did the Module Finish Without the TypeError?
Confirm that years_experience = 2 does not contain quotes. Check that the Experience line matches the reference exactly.
Ask for help reproducing the intended obstacle.
✔️ Awesome, I've got everything!
Great. Save business_card.py with the intentional mixed-type line still in place.
ⓧ I'd like to double check the full code
Compare your complete business_card.py file with this reference:
# Store the original business details in variables.
full_name = "Alex Morgan"
professional_title = "Freelance Web Designer"
years_experience = 2
hourly_rate = 45.0
available_for_work = True
# Display the type stored in each variable.
print("VARIABLE TYPES")
print("full_name:", type(full_name))
print("professional_title:", type(professional_title))
print("years_experience:", type(years_experience))
print("hourly_rate:", type(hourly_rate))
print("available_for_work:", type(available_for_work))
print()
print("Experience: " + years_experience + " years")
You have exposed how Python distinguishes text from numbers. Next, you will convert the integer safely before formatting every value on the complete card.
Convert and Format the Values
Your type report now runs in the IDLE Shell. The personal card stops when Python tries to join the integer in years_experience directly to text.
The TypeError gives you a specific display problem to solve. You will repair it with explicit conversion before switching the card to formatted string literals.
In this step, get ready to:
- Convert the experience value to text with str().
- Replace the temporary output with a complete formatted business card.
- Run the script to confirm every value appears without a traceback.
Fix the mixed-type line
String concatenation can only join text values in this expression. Calling str() creates a string version of years_experience for display while the variable keeps its int type.
- In business_card.py, find the final line that prints the experience label.
- Replace years_experience with str(years_experience) on that line.
- Click File in the IDLE menu bar.
- Click Save.
Before you rerun the module, do you expect the experience line to complete or produce the same traceback?
- Click Run in the IDLE menu bar.
- Click Run Module.
You will see Experience: 2 years below the type report. The Shell finishes without a traceback.
That is the blocker cleared: the integer now displays safely without losing its numeric type.
Why Does Explicit Conversion Work?
The str() call returns a string version of the integer. The + operators can then combine text with text.
This changes the display expression. The years_experience variable still stores the integer 2.
Still Seeing the Mixed-Type Traceback?
Check that years_experience sits inside str() on the final line. Confirm that both parentheses close before the remaining text is joined.
Ask for help comparing the expression with the intended conversion: help me fix the experience conversion
Build the complete card with formatted strings
Formatted string literals place expressions inside braces. Python converts each displayed value to text when the line is printed.
- Delete the final experience output line from business_card.py.
- Insert the complete card output below the blank print() call by pasting this code:
# Display the finished personal business card.
print("PERSONAL BUSINESS CARD")
print("======================")
print(f"Name: {full_name}")
print(f"Title: {professional_title}")
print(f"Experience: {years_experience} years")
print(f"Hourly rate: ${hourly_rate}")
print(f"Available for work: {available_for_work}")
print("======================")
How Do Formatted Strings Help?
- The f prefix activates the replacement fields inside each string.
- The {full_name} field reads the current value stored in full_name.
- The other replacement fields read their matching variables. Python converts each value for display while preserving its stored type.
- The heading and borders make the Shell output look like one complete business card.
- Click File in the IDLE menu bar.
- Click Save.
- Click Run in the IDLE menu bar.
- Click Run Module.
You will see the complete personal business card below the type report. The Shell reaches the closing border without a traceback.
Now the script has both halves working: the Shell explains each type before it presents the finished card.
Card Missing or Incomplete?
- Confirm that the complete card block sits below the blank print() call.
- Check that every formatted output line begins with f before the opening quote.
- Remove the earlier concatenation line after adding the formatted card block.
Get help checking the output block: help me debug my formatted business card
✔️ Awesome, I've got everything!
Your saved business_card.py file now contains the type report above the complete business card.
ⓧ I'd like to double check the full code
The complete file below is the exact comparison reference for business_card.py.
# Store the original business details in variables.
full_name = "Alex Morgan"
professional_title = "Freelance Web Designer"
years_experience = 2
hourly_rate = 45.0
available_for_work = True
# Display the type stored in each variable.
print("VARIABLE TYPES")
print("full_name:", type(full_name))
print("professional_title:", type(professional_title))
print("years_experience:", type(years_experience))
print("hourly_rate:", type(hourly_rate))
print("available_for_work:", type(available_for_work))
print()
# Display the finished personal business card.
print("PERSONAL BUSINESS CARD")
print("======================")
print(f"Name: {full_name}")
print(f"Title: {professional_title}")
print(f"Experience: {years_experience} years")
print(f"Hourly rate: ${hourly_rate}")
print(f"Available for work: {available_for_work}")
print("======================")
Run and read the finished result
The retained type report shows what each variable stores. The card shows how those values are presented to someone reading the Shell.
Before you run the final check, which part do you expect to appear first: the type report or the card?
- Click Run in the IDLE menu bar.
- Click Run Module.
You will first see the five type results. The report remains above the finished card.
Your text fields show str. The years_experience field shows int.
The hourly_rate field shows float. The available_for_work field shows bool.
The card starts with Alex Morgan. The next detail shows Freelance Web Designer.
The experience line reads Experience: 2 years. The rate line reads Hourly rate: $45.0.
The availability line reads Available for work: True. The Shell reaches the closing border without a traceback.
You have turned the error from the previous step into a complete card that handles every original value.
Does One Value Look Wrong?
Compare the variable name inside that formatted field with the matching assignment at the top of business_card.py. A misspelled name or misplaced brace can stop the module or display the wrong detail.
Ask for help tracing a value from its assignment to the card: help me trace the incorrect business card value
Your complete card now displays every data type without errors. Next, you will reassign the existing variables to show how their values can change.
Reassign the Business Details
Your complete business card already presents five values in the IDLE Shell. The details still reflect the original assignments.
Python variables stay useful because the values they reference can change. In this step, you will use reassignment to update the same names without changing their data types.
In this step, get ready to:
- Increase the experience and hourly rate using their current values.
- Reassign the availability value from True to False.
- Run the module to compare the updated values with their data types.
Reassign the numeric values
A reassignment expression reads a variable's current value before storing the calculated result under the same name. Your type report and card will use the new values because these updates run before either output block.
- In business_card.py, place your cursor on the blank line below available_for_work = True.
- Insert the numeric update block by adding this code:
# Reassign selected variables to updated values.
years_experience = years_experience + 1
hourly_rate = hourly_rate + 5.0
What Do These Updates Do?
- The years_experience expression reads the current integer value of 2. It stores the result 3 under the same name.
- The hourly_rate expression reads the current float value of 45.0. It stores the result 50.0 under the same name.
- The type report reads the reassigned numeric values.
- The card displays those same updated values.
- Click File in the IDLE editor menu bar.
- Select Save.
- Click Run in the IDLE editor menu bar.
- Select Run Module.
Your numeric reassignment is working. The card now shows Experience: 3 years.
You will also see Hourly rate: $50.0. The availability value remains True for now.
Still Seeing the Original Numbers?
- Confirm that the reassignment lines sit below available_for_work = True.
- Confirm that the reassignment lines sit above print("VARIABLE TYPES").
- Compare both expressions with the code block above for missing variable names or numbers.
Help me fix numeric reassignment in my business card script.
Reassign the Boolean value
The Boolean value records whether Alex is available for work. Assigning False later in the script makes the same variable name refer to a new truth value.
- In business_card.py, find this reassignment block:
# Reassign selected variables to updated values.
years_experience = years_experience + 1
hourly_rate = hourly_rate + 5.0
This block currently updates only the two numeric variables.
- Add available_for_work = False directly below hourly_rate = hourly_rate + 5.0.
- Use this completed block as your comparison:
# Reassign selected variables to updated values.
years_experience = years_experience + 1
hourly_rate = hourly_rate + 5.0
available_for_work = False
How Does the Boolean Change?
- The original assignment preserves True as the starting value.
- The later assignment stores False under the same variable name.
- The value changes while its data type remains bool.
- Click File in the IDLE editor menu bar.
- Select Save.
- Click Run in the IDLE editor menu bar.
- Select Run Module.
That Boolean update worked. The card now displays Available for work: False.
Still Seeing True?
- Confirm that available_for_work = False appears below the original available_for_work = True assignment.
- Confirm that the new line appears above print("VARIABLE TYPES").
- Check that False begins with a capital letter.
Help me troubleshoot the Boolean reassignment.
✔️ Awesome, I've got everything!
Your saved business_card.py file now contains all three reassignment lines.
ⓧ I'd like to double check the full code
The complete file below is your comparison reference:
# Store the original business details in variables.
full_name = "Alex Morgan"
professional_title = "Freelance Web Designer"
years_experience = 2
hourly_rate = 45.0
available_for_work = True
# Reassign selected variables to updated values.
years_experience = years_experience + 1
hourly_rate = hourly_rate + 5.0
available_for_work = False
# Display the type stored in each variable.
print("VARIABLE TYPES")
print("full_name:", type(full_name))
print("professional_title:", type(professional_title))
print("years_experience:", type(years_experience))
print("hourly_rate:", type(hourly_rate))
print("available_for_work:", type(available_for_work))
print()
# Display the finished personal business card.
print("PERSONAL BUSINESS CARD")
print("======================")
print(f"Name: {full_name}")
print(f"Title: {professional_title}")
print(f"Experience: {years_experience} years")
print(f"Hourly rate: ${hourly_rate}")
print(f"Available for work: {available_for_work}")
print("======================")
Compare the values and types
Reassignment changes the values used by the card. The type report lets you confirm that each updated value still belongs to its intended basic type.
Before you run the module, which card values do you expect to change? Which type names do you expect to stay the same?
- Click Run in the IDLE editor menu bar.
- Select Run Module.
You will see Experience: 3 years on the card. You will see Hourly rate: $50.0 on the next numeric line.
You will see Available for work: False near the bottom of the card.
What Stayed the Same?
The report still identifies years_experience as int.
The report still identifies hourly_rate as float.
The report still identifies available_for_work as bool.
The variable names and types remain stable while the stored values change.
You did it. Your business card now updates its details without rebuilding the output code.
Secret mission
Calculate an Introductory Rate
Use the updated hourly rate to calculate a discounted introductory rate. You will predict the result's data type before Python checks your answer and displays the new rate on the business card.
Clean Up Your Resources
Clean Up Your Resources
Everything in this lab runs locally on your Mac, so there are no ongoing cloud costs. Choose whether to keep the lab available, close it for now, or delete the saved file.
Resources you used:
- The saved business_card.py file.
- An open IDLE editor session.
- An open IDLE Shell session.
Keep everything running
No action needed. Choose this if you want to keep experimenting with your personal business card.
- Keep business_card.py in its saved location.
- Leave the IDLE editor open if you want to change the business details.
- Keep your Python 3.15.0 installation for future projects.
Pause - I'll come back to this later
Close the active IDLE session to free up memory. Your saved script stays on your Mac so you can reopen it later.
- Select File in the IDLE menu bar.
- Select Save to preserve business_card.py.
- Close the IDLE editor window using its macOS close control.
- Close the IDLE Shell window using its macOS close control.
Delete - I don't want to use this again
Remove the saved lab file to start fresh. This affects only business_card.py.
- Record the full path shown in the IDLE editor title bar here: full path to business_card.py.
- Close the IDLE editor window using its macOS close control.
- Close the IDLE Shell window using its macOS close control.
- In Finder, navigate to the folder containing full path to business_card.py.
- Delete business_card.py using Finder's file deletion control.
- Permanently remove the file using your Mac's deleted-items controls.
- Confirm that business_card.py no longer appears in its saved folder.
Your Python 3.15.0 installation remains available. IDLE also remains installed for future projects.
Nice Work!
Nice Work!
You did it! Your Python business card now presents stored details with their data types in IDLE.
You've learned how to:
- Reusable script: Build a saved business_card.py script with clearly named variables. Run it to display a personal business card in the Shell.
- Type inspection: Inspect str, int, float, and bool values with type(). Use a deliberate TypeError to identify incompatible data types.
- Conversion and reassignment: Fix mixed-type output with str(). Reassign the existing numeric and Boolean variables. Present their updated values with formatted string literals.
- Secret Mission: Calculate an introductory rate from the updated hourly rate. Predict its type before verifying that mixed int and float arithmetic produces a float.
Ready to quiz yourself?