diff --git a/.gitignore b/.gitignore index 3cfcda7..87f4579 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -/youngjin.han/dot-cdist/type/__my_computer/manifest~ -/youngjin.han/cdist.org~ -/youngjin.han/dot-cdist/type/__colourful_file/file/colourful~ -/youngjin.han/dot-cdist/type/__colourful_file/manifest~ -/youngjin.han/dot-cdist/type/__all_in_one/manifest~ +manifest~ *.py~ +*.org~ diff --git a/youngjin.han/python-the-hard-way/ex3-1.py b/youngjin.han/python-the-hard-way/ex3-1.py new file mode 100644 index 0000000..b661883 --- /dev/null +++ b/youngjin.han/python-the-hard-way/ex3-1.py @@ -0,0 +1,9 @@ +f_pi = 3.14159265358979 + +print("org =", f_pi) +print("trans format 1 = %.2f" % f_pi) +print("trans format 2 =", round(f_pi, 2)) +print("trans format 3 = %.2f" % round(f_pi, 2)) +print("trans format 4 = {:.2f}".format(f_pi)) +print("trans format 5 = {:.2f}".format(round(f_pi, 2))) +print("trans format 6 = {:.15f}".format(round(f_pi, 2))) diff --git a/youngjin.han/python-the-hard-way/ex3-2.py b/youngjin.han/python-the-hard-way/ex3-2.py new file mode 100644 index 0000000..dd88dfd --- /dev/null +++ b/youngjin.han/python-the-hard-way/ex3-2.py @@ -0,0 +1,4 @@ +print((2**8) - 1) +print((2**16) - 1) +print((2**32) - 1) +print((2**64) - 1) diff --git a/youngjin.han/python-the-hard-way/ex3.py b/youngjin.han/python-the-hard-way/ex3.py new file mode 100644 index 0000000..1276637 --- /dev/null +++ b/youngjin.han/python-the-hard-way/ex3.py @@ -0,0 +1,21 @@ +print("Hens", 25 + 30 / 6) # 25 + (30 / 6) = 25 + 5 = 30 + +print("Roosters", 100 - 25 * 3 % 4) # 100 - (25 * 3 % 4) = 100 - (75 % 4) = 100 - 3 = 97 +print("Now I will count the eggs:") # print syntex + +print(3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6) # 3 + 2 + 1 - 5 + 0 - 0.25 + 6 = 6.75 + +print("Is it true that 3 + 2 < 5 - 7?") # print syntex + +print(3 + 2 < 5 - 7) # 5 < -2 => false + +print("What is 3 + 2?", 3 + 2) # 5 +print("What is 5 - 7?", 5 - 7) # -2 + +print("Oh, that's why it's False.") # print syntex + +print("How about some more.") # print syntex + +print("Is it greater?", 5 > -2) # true +print("Is it greater or equal?", 5 >= -2) # true +print("Is it less or equal?", 5 <= -2) # false diff --git a/youngjin.han/python-the-hard-way/ex4.py b/youngjin.han/python-the-hard-way/ex4.py new file mode 100644 index 0000000..203574b --- /dev/null +++ b/youngjin.han/python-the-hard-way/ex4.py @@ -0,0 +1,17 @@ +cars = 100 # amount of car +space_in_a_car = 4.0 # amount of seats in the car +drivers = 30 # amount of driver +passengers = 90 # amount of passenger +cars_not_driven = cars - drivers # amount of person which could not drive = 70 +cars_driven = drivers # amount of person which could drive = 30 +carpool_capacity = cars_driven * space_in_a_car # amount of seat for carpool = 120 +average_passengers_per_car = passengers / cars_driven # 3 + + +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.") diff --git a/youngjin.han/python.org b/youngjin.han/python.org new file mode 100644 index 0000000..626f3d1 --- /dev/null +++ b/youngjin.han/python.org @@ -0,0 +1,11 @@ +* 2020-05-18 +** note + - ex1.py + - # is commnet. + - ex2.py + - I do't find mistakes. + - ex3.py + - none + - ex4.py + - car_pool_capacity is not defined. +