Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson6-5-2
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6880009e
authored
2 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d81e9696
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
35 deletions
diy.py
diy.py
View file @
6880009e
#
name_list=['Tom','Lily','Rose']
name_list
=
[
'Tom'
,
'Lily'
,
'Rose'
]
#
a=input('what is your name')
a
=
input
(
'what is your name'
)
#
for i in range(1):
for
i
in
range
(
1
):
#
if a in name_list:
if
a
in
name_list
:
#
print('是 ')
print
(
'是 '
)
#
else:
else
:
#
print('不是')
print
(
'不是'
)
# name_list.append("xiaoming")
name_list
.
append
(
"xiaoming"
)
# print(name_list)
print
(
name_list
)
# name_list=['Tom','Lily','Rose']
name_list
=
[
'Tom'
,
'Lily'
,
'Rose'
]
# name_list.insert(1,"lili")
name_list
.
insert
(
1
,
"lili"
)
# print(name_list)
print
(
name_list
)
# name_list=['Tom','Lily','Rose']
name_list
=
[
'Tom'
,
'Lily'
,
'Rose'
]
# name_list2=['xiaoxiao','duoduo']
name_list2
=
[
'xiaoxiao'
,
'duoduo'
]
# name_list.extend(name_list2)
name_list
.
extend
(
name_list2
)
# print(name_list)
print
(
name_list
)
# name_list2=['xiaoxiao','duoduo']
name_list2
=
[
'xiaoxiao'
,
'duoduo'
]
# name_list2[0]='peiqi'
name_list2
[
0
]
=
'peiqi'
# print(name_list2)
print
(
name_list2
)
# name_list=['Tom','Lily','Rose','Rose',]
name_list
=
[
'Tom'
,
'Lily'
,
'Rose'
,
'Rose'
,]
# name_list.pop(2)
name_list
.
pop
(
2
)
# print(name_list)
print
(
name_list
)
# name_list=['Tom','Lily','Rose','Rose',]
name_list
=
[
'Tom'
,
'Lily'
,
'Rose'
,
'Rose'
,]
# name_list.remove('Rose')
name_list
.
remove
(
'Rose'
)
# print(name_list)
print
(
name_list
)
# sum=[59,54,89,45,78,45,12,96,789,45,69]
sum
=
[
59
,
54
,
89
,
45
,
78
,
45
,
12
,
96
,
789
,
45
,
69
]
# a=0
a
=
0
# for i in range(len(sum)):
for
i
in
range
(
len
(
sum
)):
# a+=sum[i]
a
+=
sum
[
i
]
# print(a)
print
(
a
)
# sum=[59,54,89,45,78,45,12,96,789,45,69]
sum
=
[
59
,
54
,
89
,
45
,
78
,
45
,
12
,
96
,
789
,
45
,
69
]
# for i in range(len(sum)):
for
i
in
range
(
len
(
sum
)):
# if sum[i]%2==1:
if
sum
[
i
]
%
2
==
1
:
# print(sum[i])
print
(
sum
[
i
])
\ No newline at end of file
\ 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