Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
homework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ligang
homework
Commits
c8185c31
Commit
c8185c31
authored
6 years ago
by
ligang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'第二次作业'
parent
62747a50
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
02-homework-ligang/mountain.py
+17
-0
02-homework-ligang/question_answer.py
+46
-0
No files found.
02-homework-ligang/mountain.py
0 → 100644
View file @
c8185c31
#!/usr/bin/env python
# -*-coding:utf-8 -*-
import
re
def
peakIndexInMountainArray
(
s
):
sp
=
s
.
split
(
','
)
numbers
=
list
(
map
(
int
,
sp
))
if
len
(
numbers
)
<
3
or
len
(
numbers
)
>
10000
:
print
(
'长度有误 ,重新输入 '
)
exit
(
0
)
print
(
numbers
.
index
(
max
(
numbers
)))
# 格式 为:1,2,3
st
=
input
(
"请输入数字,以半角逗号分隔 ,数字不能少于3个或大于10000个 "
)
if
not
re
.
search
(
'^[0-9,]+$'
,
st
):
print
(
'match error,repeat reinput '
)
exit
(
0
)
peakIndexInMountainArray
(
st
)
This diff is collapsed.
Click to expand it.
02-homework-ligang/question_answer.py
0 → 100644
View file @
c8185c31
#!/usr/bin/env python
#-*- coding:utf-8
import
re
while
True
:
a
=
input
(
'enter your message:'
)
.
strip
()
if
"做什么"
and
(
"贪心"
or
"贪心学院"
)
in
a
:
print
(
"贪心学院是一家高端重视售后服务的在线教育培训机构"
)
break
elif
"课程"
and
"方式"
and
(
"贪心"
or
"贪心学院"
)
in
a
:
print
(
'项目式培训'
)
break
elif
"项目式"
in
a
:
print
(
'贪心学院的项目式培训结合了西方项目式培训的优点和国内的现状,最终变化成以训练营的方式进行。 做项目为主,老师负责解决部分知识的问题,学生负责自学部分知识,和不停的做项目,把知识巩固。 在项目练习中,不仅仅学习到了知识,同时也培养起来良好的学习习惯和解决问题的能力'
)
break
elif
"强"
in
a
:
print
(
'贪心学院'
)
break
elif
(
"Python"
and
"课程"
and
"学习"
)
in
a
:
print
(
"无编程基础,并且想学习编程的同学。"
)
break
elif
(
"Python"
and
"人群"
)
in
a
:
print
(
'人群包含很广泛。 第一:非IT圈内人群,想通过学习转行到编程领域中 第二:已经是IT圈内的,其他语言的开发人员,想学习Python编程 第三:已经是IT圈内的,但是并不是开发人员,如产品、测试、运维、DBA等岗位 第四:学生,未来想从事编程的工作 第五:未来想从事AI领域工作的,可先通过这门课程的学习,打下良好的基础'
)
break
elif
"优势"
in
a
:
print
(
'强大的服务体系,我们拥有每天跟学员沟通的良好服务机制。不放弃任何一个学员,只要来了,就一定要让你学会。'
)
break
elif
"数字"
in
a
:
mat
=
re
.
findall
(
'
\
d'
,
a
)
l
=
list
(
map
(
int
,
mat
))
print
(
len
(
l
))
break
elif
"手机号"
in
a
:
rs
=
re
.
findall
(
r"1\d{10}"
,
a
)
print
(
rs
)
break
elif
"ip"
in
a
:
rs
=
re
.
findall
(
r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b"
,
a
)
print
(
rs
)
break
elif
"拜拜"
or
"再见"
or
"bye"
in
a
:
print
(
"再见"
)
break
else
:
print
(
"我没看懂你的问题"
)
break
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment