Introduction to Programming in Python - C859/ WGU C859 Actual Exam Updated 2023-2024 Latest Version
- / 6
- function displays variables or expression values print()
- to keep the output of a subsequent print statement on
the same line separated by a single space end=' '
- newline character. \n
- what is put in, taken in, or operated on by any process
- to read in a string from the user and then convert that
- returns the type of an object type()
or system.
string to an integer for use in a calculation input() int(input())
- that gives the value of an object's identity id()
- when reading the input to convert the input string into
- The syntax for outputting the float myFloat with two
- Which of the following arguments completes
a float
digits after the decimal point is
print() to output two digits after the decimal point?print( .format(7.0 / 3.0)) float(input())
print('{:.2f}'.for-
mat(myFloat))
'{:.2f}'
11. What is output by print('{:.1f}'.format(0.125))? 0.1
12. What is output by print('{:.3f}'.format(9.1357))? 9.136
- The exponent operator is **
14. Compound operator: addition +=
15. Compound operator: Subtraction -=
16. Compound operator: Multiplication *=
17. Compound operator: Division /=
- / 2
Introduction to Programming in Python - C859/ WGU C859 Actual Exam Updated 2023-2024 Latest Version
- / 6
18. Compound operator: Modulo %=
- can be used to round down the result of a float-
- evaluates the remainder of the division of two integer
- Executes the contents of a file containing Python
- ensures that our file runs if we called it up by name
ing-point division to the closest whole number value.
operands.Ex. 23 10 is 3
code and makes the definitions from that file avail- able.
and not if we included this file by importing it in some other file //
%
import
if name == ' main '
- import built in math module import math
- calling a math module function for sqrt function variable =
math.sqrt(num)
- you want to generate the help of the given math help(math)
- built-in function can be used to find the length of a
- Write a statement that prints the length of the string
- A programmer can access a character at a specific
- Write an expression that accesses the first character
string
variable first_name.
index by appending containing the index
of the string my_country.len() print(len(first_name)) [ ] my_country[0]
- creates an empty list my_list = [ ]
- Write a statement that creates a list called my_nums,
- / 2
containing the elements 5, 10, and 20.my_nums = [5, 10, 20]