python: 1.write a statement (not an if statement) that stores the value True in
ID: 662700 • Letter: P
Question
python:
1.write a statement (not an if statement) that stores the value True in valid if the variable score refers to a value greater than 0 but less than or equal to 0.
2.write a statement (not an if statement) that evaluates to true if the variable points exceeds 21 and the variable player contains "dealer".
3.write a statement (not an if statement) that evaluates to true if the variable points falls between 17 and 21(inclusive) and the variable player does not contain "player".
I am a little confused about statement and expression.Can you give me an example to illustrate their differences? . also, I don't know how to write false or true expression. Would you mind giving me some guide? Thank you for answering me the question .
Explanation / Answer
1)
y=score >0 (no if used and y contains True)
2)
y = points >21 and player == "dealer"
y contains true if variable points exceeds 21 and variable player is dealer
3)
y = 17< points <= 21 and player != "player "
Y contains true if points between 17 and 21(inclusive) and player is not player
Expression: It contains only identifiers, literals and operators, where operators include arithmetic and boolean operators, the function call operator ()
eg:
Statements : these are everything that can make up a line (or several lines) of Python code.
Note that expressions are statements as well.
eg:
1. print 'hello'
2. x=22
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.