Next, I will do more exercises. I will do it myself, and I will do it myself and run it. Do not copy and paste the exercises, or skip these exercises.
1. # -- coding: UTF-8 --
2. print "Mary had a little lamb ."
3. print "Its fleece was white as % s." % 'snow'
4. print "And everywhere that Mary went ."
5. print "," * 10 # what has been done here?
6.
7.
8. end1 = "C"
9. end2 = "h"
10. end3 = "e"
11. end4 = "e"
12. end5 = "s"
13. end6 = "e"
14. end7 = "B"
15. end8 = "u"
16. end9 = "r"
17. end10 = "g"
18. end11 = "e"
19. end12 = "r"
20.
21.
22. # Check the comma. If you remove it, check what will happen.
23. print end1 + end2 + end3 + end4 + end5 + end6,
24. print end7 + end8 + end9 + end10 + end11 + end12
Running result
Mary had a little lamb.
Its fleece was white as snow.
And everywhere that Mary went.
,,,,,,,,,,
Cheese Burger
Extra score exercise
The next few exercises share the same bonus points.
1. Write comments for each line
2. Read your code carefully and find out the error.
3. Record your errors from now on and write them on paper.
4. Check your mistakes during the next exercise to avoid further mistakes.
5. programmers and magicians hope that they will never make mistakes, but that is impossible. Everyone will make mistakes.
Next, I will do more exercises. I will do it myself, and I will do it myself and run it. Do not copy and paste the exercises, or skip these exercises.
1. # -- coding: UTF-8 --
2. print "Mary had a little lamb ."
3. print "Its fleece was white as % s." % 'snow'
4. print "And everywhere that Mary went ."
5. print "," * 10 # what has been done here?
6.
7.
8. end1 = "C"
9. end2 = "h"
10. end3 = "e"
11. end4 = "e"
12. end5 = "s"
13. end6 = "e"
14. end7 = "B"
15. end8 = "u"
16. end9 = "r"
17. end10 = "g"
18. end11 = "e"
19. end12 = "r"
20. www.2cto.com
21.
22. # Check the comma. If you remove it, check what will happen.
23. print end1 + end2 + end3 + end4 + end5 + end6,
24. print end7 + end8 + end9 + end10 + end11 + end12
Running result
Mary had a little lamb.
Its fleece was white as snow.
And everywhere that Mary went.
,,,,,,,,,,
Cheese Burger
Extra score exercise
The next few exercises share the same bonus points.
1. Write comments for each line
2. Read your code carefully and find out the error.
3. Record your errors from now on and write them on paper.
4. Check your mistakes during the next exercise to avoid further mistakes.
5. programmers and magicians hope that they will never make mistakes, but that is impossible. Everyone will make mistakes.
Author: lixiang0522