python problom
1
Name:
Anonymous
2009-07-17 14:10
hi im lerning python and i need help with this i try to make lots of ifs but its not working well it looks funny heres my code
c=3
if c==1:
print'one'
else:
if c==2:
print'two'
else:
if c==3:
print'three'
else:
if c==4:
print'four'
else:
print'no number'
i want to make one for 1 to 100 but if i keep going it will get to big what do i do help plz
2
Name:
Anonymous
2009-07-17 14:17
what is this I don't even
3
Name:
Anonymous
2009-07-17 14:18
Nice indentation. FIOC LOL etc.
In any case, 1/10 i responded
4
Name:
Anonymous
2009-07-17 14:18
print {1: 'one', 2: 'two', 3: 'three', 4: 'four'}.get(c, 'no number')
5
Name:
Anonymous
2009-07-17 14:21
Just define a string array with 100 elements, each containing its index corresponding english number. THen just take whatever c is, cast it to an int, put it in the array index and PRESTO!
6
Name:
Anonymous
2009-07-17 14:23
>>4
Needs more indentation.
7
Name:
Anonymous
2009-07-17 14:45
>>1
lololol I get it xD FIOC xD
8
Name:
Anonymous
2009-07-17 15:01
>>1
>c=3
haha, an asian penis
9
Name:
Anonymous
2009-07-17 15:06
>>1
And this is why you shouldn't teach FIOC as a first programming language
10
Name:
Anonymous
2009-07-18 7:44
>>9
Because idiots exist? There's no language that will guard against that.
11
Name:
Anonymous
2009-07-18 7:53
(format t "~R" (read))
123
one hundred twenty-three
12
Name:
Anonymous
2009-07-18 8:16
13
Name:
Anonymous
2009-07-18 8:28
>>12
At the end of your
arm , stupid.
14
Name:
Anonymous
2009-07-18 9:09
15
Name:
Anonymous
2009-07-18 18:53
lol u stupid op it werk fine c i did it u dumb
http://i27.tinypic.com/308gy9y.jpg
16
Name:
Anonymous
2009-07-18 18:56
17
Name:
Anonymous
2009-07-18 18:56
>>12
What about
you are and?
18
Name:
Anonymous
2009-07-18 19:42
>>12
Shouldn't it be "at the end of your rm"?
19
Name:
Anonymous
2009-07-18 20:42
elif says hi.
20
Name:
Anonymous
2009-07-18 20:48
>>19
[b] [i] Don't Help Him! [/i] [/b] What's next? Tell him that for large numbers of items he should dispatching based on a dictionary? What is
/prog/ coming to?
21
Name:
Anonymous
2009-07-18 21:09
I wrote some code like this on here a while ago, let me find it.
Ahh, here we go.
http://dis.4chan.org/read/prog/1242279244
See post 11.
22
Name:
Anonymous
2009-07-18 23:12
>>21
Isn't avoiding this kind of shit the reason they invented the decimal system in the first place?
23
Name:
Anonymous
2009-07-18 23:46
>>22
No, they invented it because they're fags. 10 is a bad base.
24
Name:
Anonymous
2009-07-19 0:48
10 is a bad base
explain
25
Name:
Anonymous
2009-07-19 2:02
>>24
Divisible by: 2, 5. Shitsux. Even 12 would be more usefully divisible, with 2, 3, 4, 6.
But what we ought to do is this thing: convert to base 360 wholesale to unify our system of angle measure with our other calculations.
26
Name:
Anonymous
2009-07-19 2:12
>>25
Yeah, let's add 350 more digits just so it's easier to do trig.
27
Name:
Anonymous
2009-07-19 2:25
>>26
Trig is a special case. Radians are more appropriate than degrees. Also you act like 350 more digits would be less than awesome.
28
Name:
Anonymous
2009-07-19 8:15
>>26
Enjoy multiplying by
PI/180 when you write code in a
serious language .
29
Name:
Anonymous
2010-12-09 18:43