Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
wanglida
Python_Learning
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Python_Learning
/
helloworld.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
67 lines (53 loc) · 1.6 KB
master
Breadcrumbs
Python_Learning
/
helloworld.py
Copy path
Top
File metadata and controls
Code
Blame
67 lines (53 loc) · 1.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
print('Hello world! What\'s your name?') # Hello World,并测试Python是否安装成功
print("双引号引用中文.What's up?") # 中文
print('''这是三引号下的字符串
可以作为段落,\
引用多行''') # 行末的\表示字符串在下一行继续,而不是开始一个新行
print(u"This is a Unicode字符串")
a=11;b=2;c=a*b;d=a**b # 乘方
print(c,d) # 不换行输出
print(type(c)) # 输出c的数据类型
print("2左移8",(2<<8))
a=31415.e-8 # 科学计数法表示小数
print('科学计数法',a)
# 控制流 if语句
num=3
if num<5:
print("该数小于5:num=",num)
elif num==5:
print("该数等于5,num=",num)
else:
print("概述大于5:num=",num)
# while循环
res=0
while res<9:
print('The result is :',res)
res+=1
# for 循环
for letter in "IamIronMan":
print("当前字母:",letter)
AllFruits=['苹果','香蕉','桃子','葡萄','others']
for fruit in AllFruits:
print('当前水果:',fruit)
# 定义函数
def sayHello(a,b,c="末尾"): # 只有在形参表末尾的那些参数可以有默认参数值
global x
x=6
print('Hello! The fuction!a=',a,'b=',b,'c=',c)
print('函数内x=',x)
# 调用函数
x=8
sayHello(3,4)
print('x=',x)
# 文档字符串 Doc Strings
# Filename func_docp.py
def printMax(xx,yy):
'''prints the max number of two numbers.
The two values must be integers.'''
x=int(xx);y=int(yy)
if xx>yy:
print(xx,"is max")
else :
print(yy,"is max")
printMax(6,8)
print(printMax.__doc__)
You can’t perform that action at this time.