The int(), float(), and str() functions will evaluate to the integer, floating-point number, and string versions of the value passed to them. Variable names cannot begin with a number. The bacon + 1 expression does not reassign the value in bacon (that would need an assignment statement: bacon = bacon + 1).īoth expressions evaluate to the string 'spamspamspam'. All expressions evaluate (that is, reduce) to a single value.Īn expression evaluates to a single value. The three data types introduced in this chapter are integers, floating-point numbers, and strings.Īn expression is a combination of values and operators. Strings always start and end with quotes. The string is 'spam' the variable is spam.
0 Comments
Leave a Reply. |