学习报告01

本周学习了Python核心基础,包括数据类型、流程控制和字符串用法。通过实例展示了print用法、条件判断及字符串操作,如字符串长度、截取、查找等。感受到了Python的便利和魅力,但也意识到理解不足可能导致运行结果偏差。目前对学习进度满意,感谢老师的答疑帮助。
摘要由CSDN通过智能技术生成

本周学习的课程为python核心基础语法中的数据类型与方法,共三节课。

第一节课主要学习了print的一些用法,语法比较基础

作业:自动生成一段相亲介绍

name = input('您的姓名是:')
age = input('您的年龄是:')
hometown = input('您的家乡是:')
work = input('您的工作是:')
wages = input('您的收入是:')
gender = input('您的性别是:')
gender2 = "男"
gender3 = "女"
print("已为您生成相亲自我介绍:")
if gender == gender2:
    print("亲爱的女士,本人为人类高质量男性{name},今年{age}岁,家住{hometown},现在的工作是{work},收入有{wages},很希望与您见一面,希望得到您的同意")
elif gender == gender3:
    print("亲爱的先生,本人为人类高质量女性{name},今年{age}岁,家住{hometown},现在的工作是{work},收入有{wages},很希望与您见一面,希望得到您的同意")
else:
    print("别闹,搁着装外星人")
    

第二节课学习了流程控制,对各种运算符有了理解除了基础的运算符,也了解到了计算机语言中与平时理解不同的运算符。

另外还学习了条件判断语句,如if条件语句,while语句等

i = 1
j = 0
while i <= 100 and j < 20:
    if i % 2 == 0:
        print(i)
        j += 1
    i += 1
import random
ticket = 1
money = 1000
security = random.randint(0, 2)

if ticket != 1:
    print("车票已售罄")
else:
    if money < 100:
        print("用户余额不足")
    else:
        if security != 0:
            print("携带危险物品禁止上车")
        else:
            print("购票成功,请上车")
import random
ticket = 1
money = 1000
security = random.randint(0, 2)

if ticket != 1:
    print("车票已售罄")
else:
    if money < 100:
        print("用户余额不足")
    else:
        if security != 0:
            print("携带危险物品禁止上车")
        else:
            print("购票成功,请上车")
i = 1
while i <= 9:
    j = i
    while j <= 9:
        print("{}*{}={} ".format(i, j, i*j).ljust(2), end="")
        j += 1
    print("")
    i += 1

到这里已经能感受到计算机语言的魅力了

第三节课对字符串的用法进行了学习熟悉,这也是我对python感触最大的一节课。这节课开始接触python库的用法,也正式开始接触python庞大的数据量。

txt1 = "The Fisherman and The Little Barracuda"
txt2 = "渔夫和小梭鱼"
txt3 = "The fisherman casts the net into the sea and catches a little barracuda. "
txt4 = "渔夫把网撒到海里,捕到了一条小梭鱼。"
txt5 = "The pitiful fish asks the fisherman to release it。"
txt6 = "那可怜的小鱼求渔夫放了它。"
txt7 = "I am still young.He says:If you catch me after I am an adult, it is better for you."
txt8 = "他说:“我还太小。”他又说:“如果你把我放了,等我长大后再来抓我,那对你会有更大的好处!”"
txt9 = "The fisherman says: IfI giveup the present small profit to seek an uncertain future large one, am I not a fool?"
txt10 = " 渔夫说:“如果我现在放弃手上已经得到的小利而去追求那些虚无渺茫的大利,那我岂不成了傻子了吗?”"
txt11 = "This story means:Only foolish man will giveup the litterprofit which he has seekuncertain future large profits"
txt12 = "这个故事说明,愚蠢的人才会放弃已到手的小利,而去追求那些虚无的大利。"
print(len(txt1))
print(len(txt2))
print(txt3)
print(txt4[5])
print(txt5[2: 4])
print(txt6[2: -1])
print(txt7[6: len(txt7)])
print(txt8[::-1])
print(txt9[290])
print("and" in txt1)
print("and" in txt2)
txt1.find("and")
txt1.rfind("and")
txt3.count("the")
txt1.startswith("The")
txt1.endswith("The")
"asdasd".isalpha()
"123123".isdigit()
"aydb@832749".isalnum()
"ohhhhhh".rjust(50)
"ohhhhhh".ljust(50)
"ohhhhhh".center(50)

以上只是冰山一角,不得不说python的功能确实强大,也让我开始感受到python与其他语言的不同之处。python在功能强大的同时,也带来了一些学习的不便,如需要的功能理解不足就会导致运行结果与意想中相差甚远,在其他语言中对代码的微笑调整在python中也许就要查询较多的资料。

目前来说,我对自己的学习进度还算满意,希望自己可以坚持下去。

最后感谢蓝桥老师随时都在的即使答疑,对我的python学习起了巨大帮助。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值