Problem: I need a program that can add stuff together.
First, add integers together:
$ python add.py 1 2 3 4 5
15
Once you have that, then allow it to add strings too:
$ python add.py Hello World I hear it\'s beautiful out there
Hello World I hear it's beautiful out there
Extra Credit: Add numbers until it finds a non-numeric value, then treat it like a string:
$ python add.py 1 2 3 Kittens
6 Kittens
- Google "pass arguments into python script" -- what do you find?
- What are some ways to see if a string is numeric?
- How do you convert something to a number? What about to a string?
- What can you do to see if something (anything) is a string or number?