the_Fourth_lesson

1、

字典的基本操作测试

 

执行结果:

 

 

2、

函数测试代码

# -*- coding: utf-8 -*-
"""
Created on Thu Sep 22 14:14:00 2022

@author: Administrator
"""

def great_user():
'''显示简单的问候语'''
print("Hello!")

great_user()

print(range(1,3))
a=range(1,3)
print(a)

def greet_user2(username):
#显示简单的问候语
print(f"Hello,{username.title()}")

greet_user2('Fnmlet.N')

# 添加默认值,位置传参和关键值传参
def describe_pet(animal_type,pet_name=2):
# 显示宠物信息
print(f"\nI have a {animal_type}.")
print(f"My{animal_type}'s name is {pet_name}.")

describe_pet("hamster",'harry')
describe_pet(1,2)
describe_pet(pet_name=2,animal_type=1)

函数测试结果:

 

3、

leetcode刷题练习

 测试代码:

 

 测试结果:

 

posted @ 2022-09-28 11:47  FnmletN  阅读(30)  评论(0)    收藏  举报