Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

WGU Python D522

Rating
-
Sold
-
Pages
15
Grade
A
Uploaded on
29-08-2025
Written in
2025/2026

Print(10 9) print(10 == 9) print (10 9) Boolean Print(bool("hello")) print(bool("15")) print(bool(x)) Boolean examples of true Print(bool(false)) print( ) print(0) Boolean examples of false Print(isinstance(x, int)) Determine if an object is of a certain data type Int( ) Casts an integer from an integer literal, float literal, or string literal Float( ) Casts a float from an integer literal, a float literal, or a string literal Str( ) Casts a string from strings, integer literals, or a float literals Print("text") Outputs text to the console Print("text", end=" ") print("more text") Will end with a space and continue on the same line ("text more text") Print("wage", wage) Comma will print both items with a space between them Print(variable) Prints the value of the variable Print("1n2n3") Print using newline characters Print( ) Print a blank line Python Run a script file Random function WGU WGU There is no random function, but there is a random module (import random) For x in "bananas": print(x) Strings are arrays, so this will loop through the characters in "bananas" Variable=input( ) Assign text entered by the user to a variable; input is always a string Variable = int(input) Convert user input into an integer Hourly_wage = int(input("enter hourly wage: ")) Display text prompt (enter hourly wage) to request input from user and convert to integer Print(( )) Display a in console in upper case Print(( )) Display a in console as lower case Print(( )) Remove whitespace at beginning and end Print(ce("h", "j")) Replace a string with another string Print(("b")) Split string at specified character C=a+b print(c) Concatenate (combine) two strings A=(f"my name is john, i am {age}") print(a) F-string; { } is the placeholder/modifier A = 85.8756 b = format(a, ".2f") print(b) Modifier to format the value to 2 decimal places (85.88) Price = 85. b = f"price: ${price:.2f}" print(b) F-string with placeholder for price and modifier to format value to 2 decimal places (price: $85.88) What built-in data type is used when you assign text to your variable? WGU WGU Str x = "hello, world!" x = str("hello, world!") What built-in data type is used when you assign a numeric value to your variable? Int x = 20 x = int(20) float x = 20.5 x = float(20.5) complex x = 1j x = complex(1j) What built-in data type is used when you assign a sequence to your variable? List x = ["apple", "banana", "cherry"] x = list(("apple", "banana", "cherry")) tuple x = ("apple", "banana", "cherry") x = tuple(("apple", "banana", "cherry")) range x = range(6) What is the difference between a list and a tuple? List = collection of values tuple = ordered and unchangeable What built-in data type is used when you assign a mapping to your variable? Dict x = {"name" : "john", "age" : 36} x = dict(name="john", age=36) What built-in data type is used when you assign a set to your variable? Set x = {"apple", "banana", "cherry"} x = set(("apple", "banana", "cherry")) frozenset WGU WGU x = frozenset({"apple", "banana", "cherry"}) x = frozenset(("apple", "banana", "cherry")) What built-in data type is used when you assign a boolean to your variable? Bool x = true x = bool(5) What built-in data type is used when you assign binary to your variable? Bytes x = b"hello" x = bytes(5) bytearray x = bytearray(5) memoryview x = memoryview(bytes(5)) What built-in data type is used when you assign the value none to your variable? Nonetype x = none What is syntax error? Contains invalid code that cannot be understood What is indentation error? Lines of the program are not properly indented What is a value error? Invalid value is used (e.g., int(three)) What is a name error? Program tries to use a variable that does not exist What is a type error? Operation uses incorrect types (e.g. Int(5) + string(four)) How do you check which version of python editor you have? Import sys print(on) How do you edit, save, and run a python file? Edit = can edit in a text editor save = save as run = in command prompt, type Can you run python in the command line? Type python or py you will see python version information and when you are finished, type exit( )

Show more Read less
Institution
WGU D522 Python
Course
WGU D522 Python

Content preview

WGU



WGU Python D522

Print(10 > 9)
print(10 == 9)
print (10 < 9)
Boolean
Print(bool("hello"))
print(bool("15"))
print(bool(x))
Boolean examples of true
Print(bool(false))
print( )
print(0)
Boolean examples of false
Print(isinstance(x, int))
Determine if an object is of a certain data type
Int( )
Casts an integer from an integer literal, float literal, or string literal
Float( )
Casts a float from an integer literal, a float literal, or a string literal
Str( )
Casts a string from strings, integer literals, or a float literals
Print("text")
Outputs text to the console
Print("text", end=" ")
print("more text")
Will end with a space and continue on the same line ("text more text")
Print("wage", wage)
Comma will print both items with a space between them
Print(variable)
Prints the value of the variable
Print("1\n2\n3")
Print using newline characters
Print( )
Print a blank line
Python file.py
Run a script file
Random function
WGU

, WGU


There is no random function, but there is a random module
(import random)
For x in "bananas":
print(x)
Strings are arrays, so this will loop through the characters in "bananas"
Variable=input( )
Assign text entered by the user to a variable; input is always a string
Variable = int(input)
Convert user input into an integer
Hourly_wage = int(input("enter hourly wage: "))
Display text prompt (enter hourly wage) to request input from user and convert to
integer
Print(a.upper( ))
Display a in console in upper case
Print(a.lower( ))
Display a in console as lower case
Print(a.strip( ))
Remove whitespace at beginning and end
Print(a.replace("h", "j"))
Replace a string with another string
Print(a.split("b"))
Split string at specified character
C=a+b
print(c)
Concatenate (combine) two strings
A=(f"my name is john, i am {age}")
print(a)
F-string; { } is the placeholder/modifier
A = 85.8756
b = format(a, ".2f")
print(b)
Modifier to format the value to 2 decimal places (85.88)
Price = 85.87562649
b = f"price: ${price:.2f}"
print(b)
F-string with placeholder for price and modifier to format value to 2 decimal places
(price: $85.88)
What built-in data type is used when you assign text to your variable?



WGU

Written for

Institution
WGU D522 Python
Course
WGU D522 Python

Document information

Uploaded on
August 29, 2025
Number of pages
15
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$17.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
AlexScorer
2.5
(2)

Get to know the seller

Seller avatar
AlexScorer Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
10
Member since
1 year
Number of followers
0
Documents
1814
Last sold
1 month ago
Best Scorers Review Guide

Hesitate not to get 100% Recent updated and Verified Documents .Total Guarantee to success

2.5

2 reviews

5
0
4
1
3
0
2
0
1
1

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions