Exercise 24 - more practice

Posted petitherisson

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Exercise 24 - more practice相关的知识,希望对你有一定的参考价值。

 

print("Let‘s practice everything")
print("You‘d need to know ‘bout escapes with \ that do 
 newlines and 	 tabs.")

poem = """
	The lovely world
with logic so firmly planted
cannot discern 
 the needs of lovely
nor comprehend passion from intuition
and requires an explanation

		where there is none.
"""

print("-------------------")
print(poem)
print("-------------------")


five = 10 - 2 + 3 - 6
print("This should be five: %s" % five)

def secret_formula(started):
    jelly_beans = started * 500
    jars = jelly_beans / 1000
    crates = jars / 100
    return jelly_beans, jars, crates
    
    
start_point = 10000
beans, jars, crates = secret_formula(start_point)

print("With a starting point of: %d" % start_point)
print("We‘d have %d beans, %d jars, and %d crates." % (beans, jars, crates))

start_point = start_point / 10

print("We can also do that this way:")
print("We‘d have %d beans, %d jars, and %d crates" % secret_formula(start_point))

output

Lets practice everything
Youd need to know bout escapes with  that do
 newlines and    tabs.
-------------------

        The lovely world
with logic so firmly planted
cannot discern
 the needs of lovely
nor comprehend passion from intuition
and requires an explanation

                where there is none.

-------------------
This should be five: 5
With a starting point of: 10000
Wed have 5000000 beans, 5000 jars, and 50 crates.
We can also do that this way:
Wed have 500000 beans, 500 jars, and 5 crates

 

2019-09-29

17:03:13

以上是关于Exercise 24 - more practice的主要内容,如果未能解决你的问题,请参考以下文章

leetcode-24-exercise

Exercise 3: Integer Right Triangles

Exercise 3: Integer Right Triangles

Spring框架学习笔记——配置bean more

Kotlin Multiplatform 上的 KSP 在 kspJs 上失败,并显示“Collection has more than one element”。

Exercise: Maps