Skip to content

Commit

Permalink
second time
Browse files Browse the repository at this point in the history
  • Loading branch information
snow feng committed Apr 19, 2024
1 parent 093e6a6 commit 59290b9
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 0 deletions.
Binary file not shown.
15 changes: 15 additions & 0 deletions CartonPython/lesson2/hello1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/python
# Filename : ch02/hello1.py

import world1
from world1 import z
from world1 import x as x2

x = 100
y = 20

print (world1.x)
print (y)
print (z)
print (x2)
print (x)
6 changes: 6 additions & 0 deletions CartonPython/lesson2/world1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# coding=utf-8
# Filename : ch02/world1.py

x = '你好'
y = True
z = 20.0
12 changes: 12 additions & 0 deletions CartonPython/lesson5/ch5_2_1_2_snow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# Filename: ch5_2_1_2_snow.py

i = 0

while i * i < 100099:
i += 1
if i == 55:
break
print(str(i) + '*' + str(i) + ' =', i * i)
else:
print('While Over')
11 changes: 11 additions & 0 deletions CartonPython/lesson5/ch5_2_2_1_snow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# coding=utf-8
# Filename: ch5_2_2_1_snow.py

print("------字符串--------")
for item in '我是你爸爸':
print(item)

numbers = [54188 ]
print("---------整数列表---------")
for item in numbers:
print(item)
7 changes: 7 additions & 0 deletions CartonPython/lesson5/ch5_2_2_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# coding=utf-8
# Filename: ch5_2_2_2.py

for item in range(10):
print(item)
else:
print('For Over')
9 changes: 9 additions & 0 deletions CartonPython/lesson5/ch5_2_2_2_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# coding=utf-8
# Filename: ch5_2_2_2_1.py

for item in range(10):
print(item)
if item ==30:
break
else:
print('For Over')
7 changes: 7 additions & 0 deletions CartonPython/lesson5/ch5_3_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# coding=utf-8
# Filename: ch5_3_1.py

for item in range(10):
if item == 3:
break
print(item)
7 changes: 7 additions & 0 deletions CartonPython/lesson5/ch5_3_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# coding=utf-8
# Filename: ch5_3_2.py

for item in range(10):
if item == 2 or item == 4 or item == 6 or item == 8:
continue
print(item)
13 changes: 13 additions & 0 deletions CartonPython/lesson5/ch5_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# coding=utf-8
# Filename: ch5_3_2.py

i = 100; r = 0; s = 0; t = 0

while i < 1000:
r = i // 100
s = (i - r * 100) // 10
t = i - r * 100 - s * 10
if i == (r ** 3 + s ** 3 + t ** 3):
print("i = " + str(i))

i += 1

0 comments on commit 59290b9

Please sign in to comment.