Page 48 - Programming With Python 3
P. 48
An Introduction to STEM Programming with Python — 2019-09-03a Page 35
Chapter 3 — Strings, Input, and Interactive Programs
len(expression) Function
Free
len() — returns the length of a string, list, tuple, or a map.
https://docs.python.org/3/library/functions.html#len
http://bit.ly/2ENddrZ
eBook
1| name = "El. Supremo"
2| print("Your name is", len(name), "letters long.")
Your name is 10 letters long.
Edition
Converting from a string to a number and back
Please support this work at
The float() and int() functions will actually try to convert any expression or type into a float or
an integer. If the expression can't be converted, an error will be thrown. See discussion in Chapter 4 for
how to trap the error and continue the program.
http://syw2l.org
int(expression) Function
The int() function will convert a string or a floating-point number to an integer. If
it is unable to make the conversion an error will be thrown. Free
https://docs.python.org/3/library/functions.html#int
http://bit.ly/js3int
eBook
float(expression) Function
Edition
Copyright 2019 — James M. Reneau Ph.D. — http://www.syw2l.org — This work is licensed
under a Creative Commons Attribution-ShareAlike 4.0 International License.

