Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

WGU Python D522

Puntuación
-
Vendido
-
Páginas
15
Grado
A
Subido en
29-08-2025
Escrito en
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( )

Mostrar más Leer menos
Institución
WGU D522 Python
Grado
WGU D522 Python

Vista previa del contenido

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

Escuela, estudio y materia

Institución
WGU D522 Python
Grado
WGU D522 Python

Información del documento

Subido en
29 de agosto de 2025
Número de páginas
15
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$17.49
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor
Seller avatar
AlexScorer
2.5
(2)

Conoce al vendedor

Seller avatar
AlexScorer Chamberlain College Of Nursing
Ver perfil
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
10
Miembro desde
1 año
Número de seguidores
0
Documentos
1814
Última venta
1 mes hace
Best Scorers Review Guide

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

2.5

2 reseñas

5
0
4
1
3
0
2
0
1
1

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes