100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
WGU PYTHON D522 STUDY GUIDE WITH 147 QUESTIONS & CORRECT ANSWERS $20.99   Add to cart

Exam (elaborations)

WGU PYTHON D522 STUDY GUIDE WITH 147 QUESTIONS & CORRECT ANSWERS

 1 view  0 purchase
  • Course
  • WGU PYTHON D522
  • Institution
  • WGU PYTHON D522

WGU PYTHON D522 STUDY GUIDE WITH 147 QUESTIONS & CORRECT ANSWERS WGU PYTHON D522 STUDY GUIDE WITH 147 QUESTIONS & CORRECT ANSWERS

Preview 2 out of 12  pages

  • November 16, 2024
  • 12
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • WGU PYTHON D522
  • WGU PYTHON D522
avatar-seller
NurseSue
WGU PYTHON D522 STUDY GUIDE WITH 147
QUESTIONS & CORRECT ANSWERS

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
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?
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller NurseSue. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $20.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75057 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$20.99
  • (0)
  Add to cart