Learn python3 the hard way(simple notes)

Exercise 1

print('I am happy to see you here')
print( " I 'd like to see you here")
print("I am not talking to ' you'.")
print('i"am" happy to see you')

Exercise 2

print('I will now count my hens:')
print('Hens:',25+30/6)
print('Roosters:',100-25*3/4)
print("I will count the eggs:")
print(3+2+1-5+4%2-1/4+6)
print("Is it true that 3+2<5-7?:")
print(3+2<5-7)
print('What is 3+2?',3+2)
print('What is 5-7?',5-7)
print("Oh,that's why it's False.")
print('How about some more.')
print("Is is greater?",5>-2)
print("Is it greater or equal?", 5 >= -2)
print("Is it less or equal?", 5 <= -2)

Exercise 3

my_name = 'lol'
my_age = '24' # which is true
my_height = '175'
my_weight = '116'
my_eyes = 'Brown'
my_hair ='Black'

print(f"Let us talk about {my_name}.")
print(f"He's {my_height} cm tall")
print(f"He's {my_weight} grams heavy")
print(f"He's got {my_eyes} eyes and {my_hair} hair")
print("I love this guy!")

Exercise 4

types_of_people = 10
x=f"There are {types_of_people} types of people."

binary = "binary"
do_not = "don't"
y = f" Those who know {binary} and those who {do_not}."

print(x)
print(y)

print(f"I said :{x}")
print(f"I also said: '{y}' ")

hilarious = False
joke_evaluation = " Isn't that joke so funny?! {}"

print(joke_evaluation.format(hilarious))

w = "This is the left side of ..."
e = " a string wih a right side."}

print( w +e)

Exercise 5

print("Marry had a little lamb.")
print("Its fleece was white as {}.format('show'))
print("And everywhere that Mary went.")
print("." * 10)
end1 = "C"
end2 = "h"
end3 = "e"
end4 = "e"
end5 = "s"
end6 = "e"
end7 = "B"
end8 = "u"
end9 = "r"
end10 = "g"
end11 = "e"
end12 = "r"

print( end1+end2+end3+end4+end5+end6, end =' ')
print(end7+end8+end9+end10+end11+end12)

Exercise 6

formatter = "{} {} {} {}"

print(formatter.format(1,2,3,4))
print(formatter.format('one','two','three','four'))
print(formatter.format(True,False,False,False))
print(formatter.format(formatter,formatter,formatter,formatter))
print(formatter.format( "Try your","Own text here","Maybe a poem","Or a song about fear"))
		

Exercise 7

days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\naug\n"

print("""There's something going on here .
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5 ,or 6""")

Exercise 8

escape

tabby_cat = "\tI'm tabbed in."
persian_cat = "I'm split \non a line."
backslash_cat = "I'm \\a\\cat."
fat_cat = """|
I'll do a list:
\t* Cat food
\t* Fishies
\t*Catnip\n\t*Grass
"""
print(tabby_cat)
print(persian_cat)
print(backslash_cat)
print(fat_cat)

Exercise 4

print("How old are you?", end = " ")
age  = input()
print("How tall are you?",end = ' ')
height = input()
print('How much do you weight?", end = ' ')
weight = input()
print(f"So, you're {age} old, {height} tall and {weight} heavy")

进阶

age = input(" How old are you?")
height = input("How tall are you?")
weight = input("How much do you weight?")

print(f"So, you're {age} old, {height} tall and {weight} heavy")
"Learn Python the Hard Way" 是一本非常受欢迎的Python编程入门教材,由Zed Shaw编著。虽然很多人推荐这本书,但是可能有人会想要获取中文版的PDF。 实际上,"Learn Python the Hard Way" 的官方版本只有英文版,目前没有官方中文翻译。然而,你仍然可以通过互联网上的其他资源找到非官方的中文翻译版本。在很多技术论坛和编程社区上,都有Python爱好者提供自己的中文翻译版本,一些电子书资源网站上也有非官方的中文PDF版本。 要找到中文翻译版,你可以在搜索引擎中输入相关关键词,比如 "learn python the hard way 中文pdf" 或者 "learn python the hard way 中文翻译"。在搜索结果中,你可能会找到一些免费的资源供你下载或在线阅读。此外,还有一些网站提供付费的中文翻译版本,你可以根据自己的需求决定是否购买。 无论你选择哪种方式,记得要确认翻译版本的质量和真实性。可以通过查看评论、评级或者与其他Python学习者交流来了解其他人对于该版本的评价。另外,虽然中文翻译版本对于初学者会有一定帮助,但如果你有能力阅读英文,最好还是参考官方英文版来学习,以避免因为翻译的不准确而导致的误解或困惑。 总而言之,虽然"Learn Python the Hard Way"的官方版本只有英文版,但你可以通过互联网查找一些非官方的中文翻译版本。希望你能够找到一本合适的中文翻译版本,顺利学习Python编程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

万物琴弦光锥之外

给个0.1,恭喜老板发财

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值