IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Python知识库 -> 我是怎么学习python基础的(内附python编程:从入门到实践自己敲的源码) -> 正文阅读

[Python知识库]我是怎么学习python基础的(内附python编程:从入门到实践自己敲的源码)

我前几天在平台上消失了一阵子,其实一是为了学习更多的基础知识,二是现实生活中出了一点紧急状况,三是最近假期和奥运会叠加,比较想玩,没控制好自己。不过经我努力,问题已被解决,懒虫亦得到了抑制,在此和各位说声抱歉,大家久等了。


我学习python,一开始是为了学习视觉,后来是为了数据分析,刷算法题。所以为了把这门常用语言应用熟练,我把从入门到实践中自己觉得重要的书上源码和练习题敲了一遍,大家可以对照书来看,有需要可自取。(目前敲到了第八章函数,还会回来补充)

first_name="ada"
last_name="lovelace"
full_name=f"{first_name} {last_name}"
print(f"Hello,{full_name.title()}!")'''

'''message='python '
print(f"Hello,{message.strip()}")'''

'''message=14_000_000
print(message)'''

'''bicycle=['mary','cooo','tom']
print(bicycle.title())这么做是错的,列表没有这种功能'''

'''#但这样做可以
bicycle=['trek','colldale']
print(bicycle[0].title())
print(bicycle[-1].title())#返回最后一个列表元素
print(bicycle[-2].title())
'''names=['Mary','Lily','Jack']
print(names[0])
print(names[1])
print(names[2])'''
'''
names=['Mary','Lily','Jack']
message="Hello,"+names[0].title()+"!"
print(message)
message="Hello,"+names[1].title()+"!"
print(message)
message="Hello,"+names[0].title()+"!"
print(message)'''

'''ways=['own a Honda motorcycle','drive a car','walk along the road']
message="To my surprise,I want to " +ways[0]+"!"
print(message)'''

'''motorcycles=['honda','yamaha','suzuki']
last_owned=motorcycles.pop()#自动返回最后一个值
print(f"The last motorcycle I owned was a {last_owned.title()}.")'''

'''motorcycles=['honda','yamaha','suzuki']
first_owned=motorcycles.pop(0)
print(f"The first motorcycle I owned was a {first_owned.title()}.")'''

'''motorcycles=['honda','yamaha','suzuki','ducati']
print(motorcycles)
too_expensive='ducati'
motorcycles.remove(too_expensive)
print(motorcycles)
print(f"\nA {too_expensive.title()} is too expensive for me.")'''

'''names=['Mary','Lily','Jack']
len(names)
print("Hello, "+names[0]+". Please eat dinner with me")
print("Hello, "+names[1]+". Please eat dinner with me")
print("Hello, "+names[2]+". Please eat dinner with me")
jujue=names.pop(1)
print(f"The guest who can't reach is {jujue.title()}.")
print("Hello, "+names[0]+". Please eat dinner with me")
print("Hello, "+names[1]+". Please eat dinner with me")
print("I have found a larger table than before.")
names.insert(0,'Hu')
names.append('Hou')
names.insert(1,'Li')
print("Hello, "+names[0]+". Please eat dinner with me")
print("Hello, "+names[1]+". Please eat dinner with me")
print("Hello, "+names[2]+". Please eat dinner with me")
print("Hello, "+names[3]+". Please eat dinner with me")
print("Hello, "+names[4]+". Please eat dinner with me")
print("Now I can only invite two guests to dinner.")
jujue=names.pop(0)
print(f"I am very sorry that I can't invite you, {jujue.title()}.")
jujue=names.pop(2)
print(f"I am very sorry that I can't invite you, {jujue.title()}.")
jujue=names.pop(2)
#你都已经删除两个了,只剩三个了
print(f"I am very sorry that I can't invite you, {jujue.title()}.")
print("Hello, "+names[0]+". Please eat dinner with me")
print("Hello, "+names[1]+". Please eat dinner with me")
del names[0]
del names[0]
print(names)'''


'''places=['Beijing','shanghai','shenzhen','guangzhou','changsha']
print(places)
print(sorted(places))
print(places)
places.reverse()
print(places)
places.reverse()
print(places)
places.sort()
print(places)
places.sort()
print(places)'''

'''magicians=['lily','lucy','alien']
for magician in magicians:
    print(magician)
    print(f"{magician.title()},that was a great trick!")
    print(f"I can't wait to see your next trick,{magician.title()}!\n")
print("Thank you,everyone.That was a great magic show!")'''

'''pizzas=['p','q','a']
for pizza in pizzas:
    print(pizza)
    print(f"I love {pizza}!")
print("I really love pizza!")'''

'''pets=['dog','cat','mouse']
for pet in pets:
    print(pet)
    print(f"A {pet} would make a great pet!")
print("Any of these animals would make a great pet!")'''

'''magicians=['lily','lucy','ada']
for magician in magicians:#写冒号
    print(magician)
for value in range(1,5):
    print(value)#输出1到4(差一行为)
for value in range(6):
    print(value)#输出0到5(未指定初值)'''

'''numbers=list(range(1,6))
print(numbers)
even_numbers=list(range(2,11,2))
print(even_numbers)#打印1到10的偶数'''

'''squares=[]
for value in range(1,11):
    square=value**2
    squares.append(square)
print(squares)'''#square是临时变量

'''squares=[]
for value in range(1,11):
    squares.append(value**2)
print(squares)#不使用临时变量'''

'''专门用于处理数字列表的python函数'''
'''digits = list(range(2,11,2))
sum(digits)#没写print所以得不到结果'''

'''squares=[value**2 for value in range(10)]#从0开始
print(squares)'''

'''squares=[value**2 for value in range(1,11)]#从1开始到10,列表解析
print(squares)'''

'''players=['a','b','c','d','e']
print(players[0:3])
print(players[1:4])#减一
print(players[:4])#不减一
print(players[2:])
print(players[-3:])
print("Here are the first three players on my team:")
for player in players[:3]:
    print(player.title())
friend_players=players[:]
print(players)
print(friend_players)
players.append('ada')
friend_players.append('alien')
print(players)
print(friend_players)'''

'''numbers=list(range(1,21))
print(numbers)'''

'''digits=[value for value in range(1,21)]
print(digits)'''

'''numbers=list(range(1,1000001))
for number in numbers:
    print(number)
print(max(numbers))
print(min(numbers))
print(sum(numbers))'''#别忘了将其打印出来!

'''numbers=list(range(1,21,2))
print(numbers)
digits=numbers[:]
for digit in digits[:]:
    print(digits)#这个是打印整个列表10次
    print(digit)#这个才是打印单个数字'''

'''numbers=list(range(3,31,3))
print(numbers)
#print(number)如果直接生成列表的话,是无法输出单个字符的
digits=[value for value in range(3,31,3)]
print(digits)'''

'''numbers=list(range(3,31,3))
for number in numbers:
    print(number)'''
#这是最符合题干的输出方式

'''squares=[value**3 for value in range(1,11)]
print(squares)'''#列表解析生成前十个整数的立方

'''squares=[]
for value in range(1,11):
    square=value**3
    print(square)'''

'''print("The first three items in the list are:")
numbers=list(range(3,28,3))
print(numbers[0:3])
print("Three items from the middle of the list are:")
print(numbers[3:6])
print("The last three items in the list are:")
print(numbers[-3:])'''

'''foods=['sher','ioj','ihgi']
friend_foods=foods[:]
foods.append('yfyu')
friend_foods.append('ice cream')
for food in foods:
    print(foods)
for friend_food in friend_foods:
    print(friend_foods)#像复数都是直接打印列表,单数打印单个元素'''

'''dimensions=(200,50)
for dimension in dimensions:
    print(dimension)'''

'''dimensions=(200,50)
print("Original dimensions:")
for dimension in dimensions:
    print(dimension)

dimensions=(400,100)
print("\nModified dimensions:")
for dimension in dimensions:
    print(dimension)'''

'''foods=('dire','fioj','iom','ide')#中间要写单引号
for food in foods:
    print(food)
foods=('jhio','uiji','iom','ide')
for food in foods:
    print(food)'''

'''requested_toppings=['mushrooms','onions','pineapple']
if 'mushrooms' in requested_toppings:
    print("True")'''

'''banned_users=['andrew','carolina','david']
user='andrew'
if user not in banned_users:
    print(f"{user.title()},you can post a response if you wish.")
else:
    print(f"{user.title()},you can't post a response if you wish.")'''
#语法错误,else没有加冒号:

'''cars=['audi','bmw','subaru','toyota']
for car in cars:
    if car=='bmw':
        print(car.upper())
    else:
        print(car.title())'''

'''requested_toppings=['mushrooms','onions','pineapple']
if 'mushrooms' in requested_toppings:
    print("True")
else:
    print("False")
if 'pepperoni' in requested_toppings:
    print("True")
else:
    print("False")'''

'''age_0=22
age_1=18
if age_0>=21 and age_1<=21:
    print("True")'''

'''car='subaru'
print("Is car=='subaru'? I predict True.")
print(car=='subaru')
print("\nIs car=='audi'? I predict False.")
print(car=='audi')'''

'''age=17
if age>=18:
    print("You are old enough to vote!")
    print("Have you registered to vote yet?")
else:
    print("Sorry,you are too young to vote.")
    print("Please register to vote as soon as you turn 18!")'''

'''age=62
if age<4:
    print("Your admission cost is $0.")
elif age<18 or age>60:
    print("Your admission cost is $25.")
else:
    print("Your admission cost is $40.")
# or 只满足一个条件即可,and 需把两个条件都满足'''

'''age=55
if age<4:
    price=0
elif age<18 or age>60:
    price=25
else:
    price=40
print(f"Your admission cost is ${price}.")'''

'''requested_toppings=['mushrooms','extra cheese']
if 'mushrooms' in requested_toppings:
    print("Adding mushrooms.")
if 'pepperoni' in requested_toppings:
    print("Adding pepperoni.")
if 'extra cheese' in requested_toppings:
    print("Adding extra cheese.")
print("\nFinished making your pizza!")'''

'''alien_colors=['green','yellow','red']
if 'green' in alien_colors:
    print("You have win 5 points!")
else:
    print("False")'''

'''car='subaru'
print("\ncar=='subaru'? I predict True.")
print(car=='subaru')
print("car=='luhu'? I predict False.")
print(car=='luhu')'''

'''alien_0={'color':'green','points':5}
print(alien_0['color'])
print(alien_0['points'])
new_points=alien_0['points']
print(f"You just earned {new_points} points!")'''

'''alien_0={'color':'green','points':5}
print(alien_0)
alien_0['x_position']=0
alien_0['y_position']=25
print(alien_0)'''

'''alien_0={}
alien_0['color']='green'
alien_0['points']=5
print(alien_0)'''

'''alien_0={'x_position':0,'y_position':25,'speed':'medium'}
alien_0['speed']='fast'
print(f"Original position:{alien_0['x_position']},{alien_0['y_position']}")
if alien_0['speed']=='slow':
    x_increment=1
elif alien_0['speed']=='medium':
    x_increment=2
else:
    x_increment=3
alien_0['x_position']=alien_0['x_position']+x_increment
print(f"New position:{alien_0['x_position']}")'''

'''alien_0={'color':'green','points':5}
print(alien_0)
del alien_0['points']
print(alien_0)'''

'''favourite_languages={
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
language=favourite_languages['sarah'].title()
print(f"Sarah's favourite language is {language}.")'''

'''alien_0={'color':'green','speed':'slow'}
point_value=alien_0.get('points','No point value assigned.')
print(point_value)'''

'''Hou={'first_name':'Hou','last_name':'Yixin','age':18,'city':'shenyang'}
print(Hou)'''

'''favourite_numbers={
    'yixin':'6',
    'qiyu':'8',
    'zq':'7',
    'hongzhuang':'2',
    'wentao':'1',
    }#括号要与键对齐
print(favourite_numbers)
for name,number in favourite_numbers.items():
    print(f"Are you sure {number} is your favourite number? {name.title()}")'''

'''user_0={
    'username':'egibkl',
    'first':'enrico',
    'last':'fermi',
    }
for key,value in user_0.items():
    print(f"\nKey:{key}")
    print(f"Value:{value}")'''

'''favourite_languages={
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }'''
'''friends=['phil','sarah']
for name in favourite_languages.keys():#键是复数
    print(f"Hi {name.title()}.")
    if name in friends:
        language=favourite_languages[name].title()
        print(f"\t{name.title()},I see you love {language}!")
    if 'erin' not in favourite_languages.keys():
        print("Erin,please take our poll!")'''

'''favourite_languages={
    'jen':'python',
     'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
for name in sorted(favourite_languages.keys()):
    print(f"{name.title()},thank you for taking the poll.")
print("The following languages have been mentioned:")
#for language in favourite_languages.values():
    #print(language.title())
#for language in set(favourite_languages.values()):
    #print(language.title())'''
'''languages={'python','ruby','python','c'}
print(languages)'''

'''shuyu={
    'list':'liebiao',
    'for':'xunhuan',
    'array':'shuzu',
    'dist':'zidian',
    'print':'shuzu',
    }
for key,value in shuyu.items():
    print(str(key)+":"+str(value))'''

'''heliu={
    'changjiang':'China',
    'nile':'egypt',
    'huanghe':'China',
}
for key,value in heliu.items():
    print(str(key.title()) +" runs through "+ str(value.title()))'''

'''favourite_languages={
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
friends=['phil','sarah','ada']
for friend in friends:
    if friend in favourite_languages.keys():
        print(f"{friend.title()},thank you for your attention.")
    else:
        print(f"{friend.title()},please take our poll.")'''

'''alien_0={'color':'green','points':5}
alien_1={'color':'yellow','points':10}
alien_2={'color':'red','points':15}
aliens=[alien_0,alien_1,alien_2]
for alien in aliens:
    print(alien)'''

'''aliens=[]
for alien_number in range(30):
    new_alien={'color':'green','points':5,'speed':'slow'}
    aliens.append(new_alien)
for alien in aliens[:5]:
    print(alien)
print("....")

print(f"Total number of aliens:{len(aliens)}")'''

'''aliens=[]
for alien_number in range(30):
    new_alien={'color':'green','points':5,'speed':'slow'}
    aliens.append(new_alien)
for alien in aliens[:3]:#0到2,共3个外星人
    if alien['color']=='green':
        alien['color']='yellow'
        alien['speed']='medium'
        alien['points']=10
    elif alien['color']=='yellow':
        alien['color']='red'
        alien['speed']='fast'
        alien['points']=15
for alien in aliens[:5]:
    print(alien)
print("...")
for alien in aliens[:3]:
    if alien['color']=='green':
        alien['color']='yellow'
        alien['speed']='medium'
        alien['points']=10
    elif alien['color']=='yellow':
        alien['color']='red'
        alien['speed']='fast'
        alien['points']=15
for alien in aliens[:5]:
    print(alien)
print("...")'''

'''pizza={
    'crust':'thick',
    'toppings':['mushrooms','extra cheese'],
    }
print(f"You ordered a {pizza['crust']}-crust pizza with the following toppings:")
for topping in pizza['toppings']:
    print("\t"+topping)'''

'''favourite_languages={
    'jen':['python','ruby'],
    'sarah':['c'],
    'edward':['ruby','go'],
    'phil':['python','haskell'],
    }
for name,languages in favourite_languages.items():

    if(len(languages)<2):
        print(f"\n{name.title()}'s favourite language is {language[0].title()}")
    else:
        print(f"\n{name.title()}'s favourite languages are: ")
        for language in languages:
            print(f"\t{language.title()}")'''

'''users={
    'aeinstein':{
        'first':'albert',
        'last':'einstein',
        'location':'princeton',
    },
    'mcurie':{
        'first':'marie',
        'last':'curie',
        'location':'paris',
    },
}
for username,user_info in users.items():
    print(f"\nUsername:{username.title()}")
    full_name=f"{user_info['first']} {user_info['last']}"
    location=user_info['location']

    print(f"\tFull name: {full_name.title()}")
    print(f"\tLocation: {location.title()}")'''

'''people=[]
    people1={
        'first_name':'ada',
         'last_name':'lovelace',
         'age':'18',
         'city':'Beijing',
    }
    people.append(people1)
    people2={
        'first_name':'albert',
        'last_name':'einstein',
        'age':24,
        'city':'princeton',
    }
    people.append(people2)
    people3={
        'first_name':'marie',
        'last_name':'curie',
        'age':36
        'city':'paris',
    }
    people.append(people3)
print(people)'''#不能这么做

'''people1={'first_name':'ada','last_name':'lovelace','age':'18','city':'Beijing' }
people2={'first_name':'albert','last_name':'einstein','age':24,'city':'princeton' }
people3={'first_name':'marie','last_name':'curie','age':36,'city':'paris'}
people=[people1,people2,people3]
for pp in people:
    for key,value in pp.items():
        print(key+":"+str(value))
    print()#请问这句话是做什么的?
#标点符号起了一些不该犯的错误'''

'''pet1={'parrot':'ida'}
pet2={'cat':'kitty'}
pet3={'horse':'jack'}
pets=[pet1,pet2,pet3]
for pet in pets:
    for key,value in pet.items():
        print(key+":"+str(value))'''

'''favourite_places={
    'jen':['Beijing','New York'],
    'sudi':['Shanghai','Guangzhou'],
    'jingninh':['Benxi','Shenyang'],
    }
for name,city in favourite_places.items():
    print(name+":"+str(city))'''

'''favourite_numbers={
    'yixin':['6','7'],
    'qiyu':['8','9'],
    'zq':['7','8'],
    'hongzhuang':['2','3'],
    'wentao':['1'],
    }#括号要与键对齐
print(favourite_numbers)
for name,numbers in favourite_numbers.items():#列表中是复数
    print(f"\nAre you sure {numbers} is your favourite number? {name.title()}")
    if(len(numbers)<2):
        print(f"\n{name.title()}'s favourite number is {numbers[0]}")
    else:
        print(f"\n{name.title()}'s favourite numbers are:")
        for number in numbers:
            print(number)'''

'''cities={
    'Beijing':{'country':'China',
               'population':'2.5 million',
               'fact':'the capital of China',
               },
    'New York':{'country':'America',
               'population':'1.4 million',
               'fact':'the capital of America',
               },
    'London':{'country':'England',
               'population':'2 million',
               'fact':'the capital of England',
               },
}
print(cities)
for cityname,city_information in cities.items():
    print(f"\ncityname: {cityname}")
    country=f"{city_information['country'].title()}"
    population=city_information['population']
    fact=city_information['fact']

    print(f"\ncountry:{country}")
    print(f"\npopulation:{population}")
    print(f"\nfact:{fact}")
    print(f"\n\n")'''

'''message=input("Tell me something,and I will repeat it back to you:")
print(message)'''

name=input("Please enter your name:")
print(f"\nHello,{name}!")
'''favourite_languages={
    'jen':['python','ruby'],
    'sarah':['c'],
    'edward':['ruby','go'],
    'phil':['python','haskell'],
    }
for name,languages in favourite_languages.items():
#两个键
    if(len(languages)<2):
        print(f"\n{name.title()}'s favourite language is {languages[0].title()}")
    else:
        print(f"\n{name.title()}'s favourite languages are: ")
        for language in languages:
            print(f"\t{language.title()}")'''

'''prompt="If you tell us who you are,we can personalize the messages you see."
prompt+="\nWhat is your first name?"
name=input(prompt)
print(f"\nHello,{name}.")'''

'''age=input("How old are you?")
age=int(age)
if age>=18:
    print("\nYou are old enough!")
else:
    print("\nYou'll be able to play computer games when you're a little older.")'''

'''height=input("How tall are you,in inches?")
height=int(height)

if height>=48:
    print("\nYou're tall enough to ride!")
else:
    print("\nYou'll be able to ride when you're a little older.")'''

'''number=input("Enter a number,and I'll tell you if it's even or odd:")
number=int(number)

if number%2==0:
    print(f"\nThe number {number} is even.")
else:
    print(f"\nThe number {number} is odd.")'''

'''car=input("\nCan you tell me which car you want to rent?")
print(f"\nLet me see if I can find you a {car}.")'''

'''number=input("Enter how many people will eat this meal.")
number=int(number)
if number>8:
    print("There aren't free tables.")
else:
    print("There are free tables.")'''

'''number=input("Please input a number:")
number=int(number)
if number%10==0:
    print("这个数是十的整数倍")
else:
    print("这个数不是十的整数倍")'''

'''current_number=1
while current_number<=5:
    print(current_number)
    current_number+=1'''

'''prompt="\nTell me something,and I will repeat it back to you:"
prompt+="\nEnter 'quit' to end the program."
message=input(prompt)
while message!='quit':
    message=input(prompt)
    print(message)'''
    #必须先定义message,否则会报错
    #如果这样写,就算提前定义了,但是输出结果也会因两次读取而变为问题输入的字符串

#真正的解决方式应该是先给message选定一个初始值
'''prompt="\nTell me something,and I will repeat it back to you:"
prompt+="\nEnter 'quit' to end the program."
message=" "
while message!='quit':
    message=input(prompt)
    if message!='quit':
       print(message)'''

'''prompt="\nTell me something,and I will repeat it back to you:"
prompt+="\nEnter 'quit' to end the program."
active=True
while active:
    message=input(prompt)
    if message=='quit':
        active=False
    else:
        print(message)'''

'''prompt="\nPlease enter the name of a city you have visited:"
prompt+="\n(Enter 'quit' when you are finished.)"
while True:
    city=input(prompt)
    if city=='quit':
        break
    else:
        print(f"I'd love to go  to {city.title()}!")'''

'''current_number=0
while current_number<10:
    current_number+=1
    if current_number%2==0:
        continue
    print(current_number)'''

'''x=1
while x<=5:
    print(x)
    x+=1'''

'''ingreient=input("Please add some pizza ingreients:")
while ingreient!='quit':
    print(ingreient)
    #这段代码会一直打印直到输出了quit'''
#输出一次的话,输出的是后来新设定的字符串,看看下段代码就明白了

''''#这是一段正确的代码
message="\nPlease add some pizza ingreients:"
message+="\n(Enter 'quit' to end the program)"
ingreient=" "
while ingreient!='quit':
    ingreient=input(message)
    if ingreient!='quit':
        print(ingreient)'''

''''#上面那段代码的简化版
message="\nPlease add some pizza ingreients:"
message+="\n(Enter 'quit' to end the program)"
active=True
while active:
    ingreient=input(message)
    if ingreient=='quit':
        active=False
    else:
        print(ingreient)'''

'''age="Please input your age: (Enter 'quit' to end the program)"
active=True
while active:
    message=input(age)
    if age=='quit':
        active=False
    else:
        age=int(message)
        if age<3:
            print("You don't need money.")
        elif age>=3 and age<=12:
            print("Please give me ten dollars.")
        else:
            print("Please give me 15 dollars.")
#用input就不要再用int把字符串转化为数字了,否则运行第二次的时候会报错'''

#其实可以这么写
'''age=input("Please input your age: (Enter 'quit' to end the program)")
if age!='quit':
    age=int(age)
    if age<3:
       print("You don't need money.")
    elif age>=3 and age<=12:
       print("Please give me ten dollars.")
    else:
       print("Please give me 15 dollars.")
else:
    pass'''

'''unconfirmed_users=['alien','brian','candace']
confirmed_users=[]

while unconfirmed_users:
    current_user=unconfirmed_users.pop()#当前的使用者
    print(f"Verifying user:{current_user.title()}")#正在核实身份的使用者
    confirmed_users.append(current_user)
    
print("\nThe following users have been confirmed:")
for confirmed_user in confirmed_users:
    print(confirmed_user.title())'''


'''pets=['dog','cat','dog','rabbit','goldfish','cat']
print(pets)
while 'cat' in pets:
    pets.remove('cat')
print(pets)'''

'''responses={}
polling_active=True
while polling_active:
    name=input("\nWhat is your name?")
    response=input("Which mountain would you like to climb someday?")

    responses[name]=response
    repeat=input("Would you like to let another person respond?(yes/no)")
    if repeat=='no':
        polling_active=False
print("\n---Poll Results---")
for name,response in responses.items():
    print(f"{name} would like to climb {response}.")'''

'''sandwich_orders=['fruit','tuna','chicken']
finished_sandwiches=[]
while sandwich_orders:
    current_sandwich=sandwich_orders.pop()
    print(f"I made your {current_sandwich} sandwich.")
    finished_sandwiches.append(current_sandwich)
print("\nThe following sandwiches have finished:")
for finished_sandwich in finished_sandwiches:
    print(finished_sandwich.title())'''

'''sandwich_orders=['fruit','tuna','chicken','pastrami','pastrami']
print(sandwich_orders)
while 'pastrami' in sandwich_orders:
    sandwich_orders.remove('pastrami')
print(sandwich_orders)'''

'''responses={}
active=True
while active:
    name=input("\nWhat is your name?")
    response=input("\nIf you could visit one place in the world,where would you go?")
    responses[name]=response
    repeat=input("\nWould you like to let another person respond?(yes or no)?")
    if repeat=='no':
        active=False
print("\n----Results----")
for name,response in responses.items():
    print(f"\n{name} would like to visit {response}.")'''

我和大家保证这里面的每段代码都可以成功运行,因为都是我自己一点点试出来的。。。。


谈谈学习方法

快速学习:看相关学习网站博客,不出一周便可以学会基础

缺点:使用不扎实

适合:不把python当做自己的主语言之一,做一项快速的任务

慢速学习:找本好书,把基础练习题学一遍之后再学自己想学的技能

缺点:学得慢,耽误事

适合:把python当做自己的主语言之一,且之后常常使用

不建议:看视频

原因:看视频会使自己掌握的知识都处于一种半会不会的状态,非常不利于学习(对于我自己来说)

话说想让我推荐python的书也可以

最后拿一张自己书的照片镇楼吧

?

?

?

?

?

  Python知识库 最新文章
Python中String模块
【Python】 14-CVS文件操作
python的panda库读写文件
使用Nordic的nrf52840实现蓝牙DFU过程
【Python学习记录】numpy数组用法整理
Python学习笔记
python字符串和列表
python如何从txt文件中解析出有效的数据
Python编程从入门到实践自学/3.1-3.2
python变量
上一篇文章      下一篇文章      查看所有文章
加:2021-08-10 13:22:40  更:2021-08-10 13:23:13 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/17 12:33:07-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码