笨方法学python1~14

#ex4 1-17
print("\n\nex4")
cars=100
space_in_a_car=4
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",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",round(average_passengers_per_car),"in each car.")

#ex5 19-33
print("\n\nex5")
my_name="cao"
my_age=22 #这是真的
my_height="186cm"
my_weight="90kg"
my_eyes="black"
my_teeth="white"
my_hair="black"
print(f"lets talk about {my_name}")
print(f"he is {my_age-1} years old")
print(f"he is {my_height} tall")
print(f"he is {my_weight}")
print(f"he has {my_eyes} eyes and {my_teeth} teeth and {my_hair} hair.")
print("thats a good man")

#ex6 35-52
print("\n\nex6")
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}'")

bilarious=False
joke_evaluation="Isn't that joke so funny?{}!"
print(joke_evaluation.format(bilarious))

w="This is the left side of……"
e="a string with a right side"

print(w+e)
print("居然还可以这样",end=' lalal')
print("然后就可以不换行了");
print('不加",end=‘链接内容’""就不太行')

#ex7 61-71
print("\n\nex7")
print("Mary had a little lamb")
print("Its fleece was white as{}.".format('snow'))
print("And everywhere that Mary want")
print("."*10)#Guess what will happen

end1="c";end2="h";end3="s";end4="e";end5="B";end6="u";end7="r";end8="g"

print(end1+end2+end4*2+end3+end4,end=' ')
print(end5+end6+end7+end8+end4+end7)

#ex8
print("\n\nex8")
formatter="{} {} {} {}"
print(formatter.format("one","two","three","four"))
print(formatter.format(True,False,True,True))
print(formatter.format(formatter,formatter,formatter,formatter))
formattermax=formatter.format(formatter,formatter,formatter,formatter)
print(formatter.format(formattermax,formattermax,formattermax,formattermax))
print(formatter.format("I","Luv","U","Baby"))
print(formatter.format("I","Know","U","Well"))
print(formatter.format("I","struggle","for forever","being with U"))

"""ex9
fdssdfsdfsdfsd"""
print("\n\nex9")
days="Mon Tue Wed Thu Fri Sat Sun"
months="\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"

print("日期:",days)
print("月份:",months)
print(
'''荒凉的山岗上站着四姐妹
所有的风只向他们吹
所有的日子都为她们破碎''')

#ex10
print("\n\nex10")
我爱你=3
print(我爱你)
猫="\ti'm tabbed in"
persian_cat="I'm split\non a line"
blackslash_cat="I'm\\a\\cat"
fat_cat="""
I'll do the list:
\t*cat food
\t*Fishies
\t*Cathip\n\t*Grass
"""
print(猫)
print(persian_cat)
print(blackslash_cat)
print(fat_cat)

#ex11
"""print("How old are U",end=' ')
print("How old are U","laaaa",end=' ')
#age=input()#输个小数试试
print("输个小数试试")
#agewhat=int(float(input()))
print(f"{age} years old")
print(f"{agewhat} years old")

#ex12
age2=int(float(input("How old are U?")))
print(f"I'm {age2} years old")

""""""ex13"""
'''from sys import argv
script,first,second,third=argv

print("The script is called:",script)
print("第一个字符是:",first)
print("第二个字符是:",second)
print("第三个字符是:",third)'''

#ex14
print("\n\nex14")
from sys import argv

script,user_name=argv
prompt=">回答"
print(f"""Hi {user_name}, I'm the {script} script
I'd like to ask u 4 a few questions
\tDo U Luv me,{user_name}""")
luv=input(prompt)
print(f"where do u libe, {user_name}")
live=input(prompt)
print(f"What kind of computer do u have,{user_name}")
computer=input(prompt)
print(f"Alright,so U said U {luv} me,\nU live in {live}.Not sure where that is. \nAnd U have a {computer} computer .\nNice,I luv U")
print(f"""Alright,so U said U {luv} me,
U live in {live}.Not sure where that is.
And U have a {computer} computer .
Nice,I luv U""")

学习笔记从15开始记录,前面的过于基础和简单

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值