-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
print "Hello World!" | ||
print "Hello Again" | ||
print "I like typing this." | ||
print "This is fun." | ||
print 'Yay! Printing.' | ||
print "I'd much rather you 'not'." | ||
print 'I "said" do not touch this.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# A comment, this is so you can read your program later. | ||
# Anything after the # is ignored by python. | ||
|
||
print "I could have code like this." # and the comment after is ignored | ||
|
||
# You can also use a comment to "disable" or comment out a piece of code: | ||
# print "This won't run." | ||
|
||
print "This will run." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 在console输出 | ||
print "I will now count my chickens:" | ||
|
||
# 在console输出,逗号后的部分做计算 | ||
print "Hens", 25 + 30 / 6 | ||
print "Roosters", 100 - 25 * 3 % 4 | ||
|
||
# 在console输出 | ||
print "Now I will count the eggs:" | ||
|
||
# 计算 | ||
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 | ||
|
||
# 在console输出 | ||
print "Is it true that 3 + 2 < 5 - 7?" | ||
|
||
# 在console输出不等式两边比较大小的结果 | ||
print 3 + 2 < 5 - 7 | ||
|
||
# 在cosole输出,并做计算 | ||
print "What is 3 + 2?", 3 + 2 | ||
print "What is 5 - 7?", 5 - 7 | ||
|
||
# 在console输出 | ||
print "Oh, that's why it's False." | ||
|
||
# 在console输出 | ||
print "How about some more." | ||
|
||
# 在console输出,并比较不等式两边的大小 | ||
print "Is it greater?", 5 > -2 | ||
print "Is it greater or equal?", 5 >= -2 | ||
print "Is it less or equal?", 5 <= -2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cars = 100 | ||
space_in_a_car = 4.0 | ||
drivers = 30 | ||
passengers = 90 | ||
cars_not_driven = cars - drivers | ||
cars_driven = drivers | ||
carpool_capacity = cars_driven * space_in_a_car | ||
average_passengers_per_car = passengers / cars_driven | ||
|
||
|
||
print "There are", cars, "cars available." | ||
print "There are only", drivers, "drivers available." | ||
print "There will be", cars_not_driven, "empty cars today." | ||
print "We can transport", carpool_capacity, "people today." | ||
print "We have", passengers, "to carpool today." | ||
print "We need to put about", average_passengers_per_car, "in each car." |