I think I might be going about this a strange way in Python, but here's what I've been doing.
Code:
#!/usr/bin/env python
entered = raw_input("Enter numbers, separate numbers by spaces ")
numbers = entered.split(" ")
This achieves what I want but trying to pass this through a for statement and do arithmetic seems to not work
Code:
...
temp = 0
for elem in numbers:
temp = temp + elem
So I get this error: TypeError: unsupported operand type(s) for +: 'int' and 'str'
So I guess I'm asking can you make python think that elem in the for statement is an int and definitely not a string.
Recent comments
23 hours 56 min ago
1 day 2 hours ago
1 day 4 hours ago
1 day 5 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 9 hours ago
2 days 1 hour ago
2 days 2 hours ago
2 days 6 hours ago