自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 Day14_100days of python coding

################### Scope ####################enemies = 1def increase_enemies(): enemies = 2 print(f"enemies inside function: {enemies}")increase_enemies()print(f"enemies outside function: {enemies}")Local scopeit exists in functionsWhen..

2021-11-03 22:49:54 70

原创 Day12----100 days of python coding

设置一个variable==True,直接用:like:if variable :就好了;If we want to let the above function again, then we can just define what we have coded,and call itRecursion????

2021-10-31 22:14:33 80

原创 Day11—100days of python coding

Funtions with Outputsdef my_function(): result = 3*2 return resultwhen call my_function()my_function() is replaced by the returnthen we can save this result as another variablelike:output = my_functionReturn tells the computer it is

2021-10-30 23:29:17 84

原创 Day11--100 days of Python coding

The python dictionaryNesting要区别dictionary中如这个:print(dict[1])[1]就并不是代表key的顺序了,而[]里面直接就是key的名称.即[1]就代表名为1的keyfrom replit import clearclear()

2021-10-28 23:22:32 88

原创 Day9_100 days of python coding

Positional & keyword Argumentspositional argue:cuz we didn't specify

2021-10-26 23:05:17 71

原创 Day9_100 days of python coding

Positional & keyword ArgumentsPositional argument:cuz we didn't specify anywhere which particular parameter we want to associate these dataswith在解决实际问题的时候,用round()不能解决像1.2,实际上我们需要2而不是1python - How do you round UP a number? - Stack Overflowht.

2021-10-25 23:52:11 82

原创 Day8_100days of Python coding

如何在python的list里面使用函数?https://developers.google.com/edu/python/lists#for-and-inhttps://developers.google.com/edu/python/lists#for-and-in

2021-10-25 22:20:59 69

原创 Day8_100days of Python coding

如何在python的list里面使用函数?https://developers.google.com/edu/python/lists#for-and-inhttps://developers.google.com/edu/python/lists#for-and-inpythonlist????: colors = ['red', 'blue', 'green'] print colors[0] ## red print colors[2] ## green print l...

2021-10-24 23:10:57 84

原创 Day7_100days of code in python

Indentation:def my_function(): print("Hello")Spaces vs. TabsPEP 8 -- Style Guide for Python Code | Python.orghttps://www.python.org/dev/peps/pep-0008/While loopsWhat about the for loop:for item in list_of_items: #Do something to each ite

2021-10-23 23:23:59 58

原创 Day6_100days of coding in python

How to randomly choose elements in a list in pythonrandom.sample(list,number)the outcome of therandom.sample(list,number)is still a listlike["b","c"]如果我只是想要strings的和平组合,那么开始的时候,password=“”由于我要randomly combine:故我需要password【】for char in..

2021-10-23 21:21:36 68

原创 Day5_100 days of python coding

For loopsum( ) to calculate the total figures of the listfor loop will run any times the number of the item有时候我们只需要它赋值的次数罢了。

2021-10-22 16:21:49 67

原创 Day 4_#100days of python coding

Random ModulePython random Module - Generate Random Numbers/Sequences - AskPythonhttps://www.askpython.com/python-modules/python-random-module-generate-random-numbers-sequencesPython listlist_name[] 从0开始,最后一个是-1可以替换:list_name[1]= "mmm"append(),

2021-10-20 23:39:42 65

原创 Day 3 #100 days of Python coding

Multiple if statement if statements will all be executed.compared to if elif else creat a variable to vary Indentation matters a huge bill 其实可以不用else statement 可以是, if elif elif Logical operator A and B C or D not E ...

2021-10-20 15:39:05 56

原创 Day2--#100Days of python coding

Mathematical operation in python string can't be converted to int need to be float() first Number manupulation and f string in python Round the number use round( ) round(8/3,3) round to different desimal places Use floor divison--- 8//3type(8//.

2021-10-19 22:30:46 68

原创 Day1—#100 Days of coding

print() 1:第一个function_ print()2:""与‘’ string and code3:换行的backslashprint("Hello World!\nHello World!")4:学习string的概念String Concatenation5:Indentation6:Syntax error7:code block 就是感觉是一行代码8:input() functionA promt for the user9:Pyth...

2021-10-18 21:30:47 65

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除