next up previous contents
Next: ű⿡ ? Up: Ϲ ̽ ħ Previous:  

Ϻ

Hello, World

˾ƾ

ؽƮ ⿡ α׷ ϴ , װ͵ ũ(÷dz ϵ) ϰ ׸ װ͵ ѹ Ǹ ϴ ˾ƾ Ѵ.

α׷ ħ ʹݺο Hello, World! θ α׷ Ѵ. ׷ ⿡ װ ̸:

print "Hello, World!"

ɾ Ͽ α׷ Ϸ װ ؽƮ ȿ ŸϿ, װ hello.py ϰ ׸ ``python hello.py'' װ ϶.

׷ IDLE , ο 츦 ϰ, װ 1.4 ۼ϶.

α׷ Ǿ ⿡ װ ϴ Ÿ:

Hello, World!

п Ź ̰ ̾߱ ʰڴ. ׷ п ϳ α׷ شٸ, װ Ÿغ Ͽ ⸦ Ѵ. μ װ Ÿ , ׷ Ѵ.

⿡ α׷ ִ:

print "Jack and Jill went up a hill"
print "to fetch a pail of water;"
print "Jack fell down, and broke his crown,"
print "and Jill came tumbling after."

α׷ ϸ װ ϴ ٴ:

Jack and Jill went up a hill
to fetch a pail of water;
Jack fell down, and broke his crown,
and Jill came tumbling after.

ǻͰ α׷ ϸ װ :

print "Jack and Jill went up a hill"
׷ ǻͰ ϴ :
Jack and Jill went up a hill

׸ ǻʹ ̰ :

print "to fetch a pail of water;"

׷ ǻʹ ũ :

to fetch a pail of water;

ǻʹ Ǹ鼭, ɾ ׸ . ǻʹ α׷ ϱ ɾ Ͽ Ѵ.

ǥ

⿡ ϳ α׷ ִ:
print "2 + 2 is", 2+2
print "3 * 4 is", 3 * 4
print 100 - 1, " = 100 - 1"
print "(33 + 2) / 5 + 11.5 = ",(33 + 2) / 5 + 11.5

׸ ⿡ α׷ Ǿ ִ:

2 + 2 is 4
3 * 4 is 12
99  = 100 - 1
(33 + 2) / 5 + 11.5 =  18.5

̽ õ޷¥ ǻ͸ 5޷¥ ٲ ִ.

̽㿡 6 ⺻ ó ִ:

ó ɺ
ȭ ** 5 ** 2 == 25
* 2 * 3 == 6
/ 14 / 3 == 4
% 14 % 3 == 2
+ 1 + 2 == 3
- 4 - 3 == 1

Ģ ϶, Ҽ· ʾҴٸ, ݵ Ҽ· ʴ´. α׷ ̰ ش:

print "14 / 3 = ",14 / 3
print "14 % 3 = ",14 % 3
print
print "14.0 / 3.0 =",14.0 / 3.0
print "14.0 % 3.0 =",14 % 3.0
print
print "14.0 / 3 =",14.0 / 3
print "14.0 % 3 =",14.0 % 3
print
print "14 / 3.0 =",14 / 3.0
print "14 % 3.0 =",14 % 3.0
print
:
14 / 3 =  4
14 % 3 =  2

14.0 / 3.0 = 4.66666666667
14.0 % 3.0 = 2.0

14.0 / 3 = 4.66666666667
14.0 % 3 = 2.0

14 / 3.0 = 4.66666666667
14 % 3.0 = 2.0
Ҽ Ǿ° ƴѰ ̽  鿡 ޸ϰ ִ ָ϶.

ó п ̴:

  1. ȣ ()
  2. **
  3. *, \, ׸ %
  4. + ׸ -

(ٸ ) ȭ

α׷  ϰ ߴ 巡 𸥴. ̷ Ͼ α׷ Ƹ ּ ٿ߸ Ѵ. ּ а ٸ α׷ӵ鿡 Ͼ ִ ִ ǥ̴. :

#Not quite PI, but an incredible simulation
print 22.0/7.0
ּ # ۵ǰ ָ϶. ּ α׷ д ٸ ̵ ϱ ̸ ̷ ڽſ ͵ Ȯϰ ֱ ̴.

(ᱹ) 忡 Ұ α׷ 鿡 ϰ ̴. װ͵ ϰ ִ  Ⱦ ؾ Ѵ. ذ Ȱٸ, װ͵ Ÿ ְ Ͼ 캸. ׷ װ͵ ȥٸ, װ͵ ؼ Ͼ 캸.

Denmark.py

print "Something's rotten in the state of Denmark."
print "                -- Shakespeare"

:

Something's rotten in the state of Denmark.
                -- Shakespeare

School.py

#This is not quite true outside of USA
# and is based on my dim memories of my younger years
print "Firstish Grade"
print "1+1 =",1+1
print "2+4 =",2+4
print "5-2 =",5-2
print
print "Thirdish Grade"
print "243-23 =",243-23
print "12*4 =",12*4
print "12/3 =",12/3
print "13/3 =",13/3," R ",13%3
print
print "Junior High"
print "123.56-62.12 =",123.56-62.12
print "(4+3)*2 =",(4+3)*2
print "4+3*2 =",4+3*2
print "3**2 =",3**2
print

:

Firstish Grade
1+1 = 2
2+4 = 6
5-2 = 3

Thirdish Grade
243-23 = 220
12*4 = 48
12/3 = 4
13/3 = 4  R  1

Junior High
123.56-62.12 = 61.44
(4+3)*2 = 14
4+3*2 = 10
3**2 = 9


next up previous contents
Next: ű⿡ ? Up: Ϲ ̽ ħ Previous:  
Josh Cogliati jjc@iname.com