Docsity

Essential Python Programming Concepts: A Quick Reference Guide, Exams of Nursing

Toggle sidebar
bg1
Python programming
import <module> - Answersloads an existing Python module into the current program
block - Answersone of more lines of code grouped together with the same minimum amount of
indentation
while <condition>: - Answersbegins a pre-test loop
if <condition>: - Answersbegins a binary selection statement
break - Answerstells the program to immediately jump out of a while-block
random.randint(low, high) - Answersreturns a random integer between (and including) the two
integers we give it
int(string) - Answersconverts the string argument to its integer form.
str(number) - Answersconverts a numeric argument to its string form.
true - Answersthe Boolean data value for yes/on/one
false - Answersthe Boolean data value for no/off/zero
pf3

Partial preview of the text

Download Essential Python Programming Concepts: A Quick Reference Guide and more Exams Nursing in PDF only on Docsity!

Python programming

import - Answersloads an existing Python module into the current program block - Answersone of more lines of code grouped together with the same minimum amount of indentation while : - Answersbegins a pre-test loop if : - Answersbegins a binary selection statement break - Answerstells the program to immediately jump out of a while-block random.randint(low, high) - Answersreturns a random integer between (and including) the two integers we give it int(string) - Answersconverts the string argument to its integer form. str(number) - Answersconverts a numeric argument to its string form. true - Answersthe Boolean data value for yes/on/one false - Answersthe Boolean data value for no/off/zero

== - Answersthe comparison operator for equality. Used in conditions, "Is value1 equal to value2?" input() - Answersa function that takes user keyboard input and returns it to the program as a string. \ - AnswersBackslash, the Python string escape character / - AnswersForward slash, the Python division operator \ - AnswersRepresents a single backslash in a Python string \n - AnswersRepresents a new line in a Python string \t - AnswersRepresents a tabbed space in a Python string ' - AnswersRepresents an apostrophe in a Python string ' - AnswersSingle quote, can be used to surround a string literal value " - AnswersDouble quotes, can be used to surround a string literal value def : - AnswersIndicates the beginning of a function definition and - AnswersThe Boolean operator that only returns true if BOTH of its operands are true. or - AnswersThe Boolean operator that returns true if EITHER of its operands are true