Thread Rating:
- 0 Vote(s) - 0 Average
- 1
- 2
- 3
- 4
- 5
Subscripting Integers?
|
Posts: 401
Threads: 141
Joined: Oct 2009
Reputation:
5
How can I do something like this:
Code: x = 29
if x[1] == 9:
print "The second digit is 9"
else:
print "The second digit is not 9"
However I can't do this because you can't subscript integers. How can I get around that?
Posts: 245
Threads: 33
Joined: Oct 2009
Reputation:
10
(02-18-2010, 09:17 PM)nevets04 Wrote: How can I do something like this:
Code: x = 29
if x[1] == 9:
print "The second digit is 9"
else:
print "The second digit is not 9"
However I can't do this because you can't subscript integers. How can I get around that?
Cmon Nevets, convert it
Posts: 103
Threads: 7
Joined: Oct 2009
Reputation:
5
Code: Number = 929302.023
if str(Number)[1] == "2": print "Second number is 2"
Terrorcore, unleash, extermination
Hyper real, cold blood, determination
fudge them, I like this sensation
Incredible, I from the annihilation
Posts: 401
Threads: 141
Joined: Oct 2009
Reputation:
5
(02-18-2010, 09:20 PM)uber1337 Wrote: Cmon Nevets, convert it
Lol, I feel dumb. It's been a while
|
Users browsing this thread: 1 Guest(s)