Review: what’s a number?

How do we know a string is a number?

Assume that for both short project 07 and programming project 07 you won’t have strings that mix digits (for example 0 and 9) and letters (for example a and x)

How do we know the following strings are names vs. numbers (integers or floats)?

  • "Petra"
  • "10.5"
  • "5"

Check first character of a string

Remember that you can retrieve the first character of a string using [0]

name = "Petra"
name[0].isnumeric()
False
number = "0.10"
number[0].isnumeric()
True
number = "10"
number[0].isnumeric()
True

Short Project

Instructions for Short Project of the Week