Skip to content

Commit e89c35f

Browse files
Merge branch 'master' of github.com:anuragkumarak95/Python
2 parents 2d846e7 + 4ab73bc commit e89c35f

File tree

4 files changed

+20
-25
lines changed

4 files changed

+20
-25
lines changed

CountMillionCharacter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@
247247
That even our corn shall seem as light as chaff
248248
And good from bad find no partition.
249249
ARCHBISHOP OF YORK
250-
No, no, my lord. Note this; the king is weary
250+
No, no, my lord. Note this; the king is weary
251251
Of dainty and such picking grievances:
252252
For he hath found to end one doubt by death
253253
Revives two greater in the heirs of life,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# My Python Examples.
33

4-
Here is some more detailed information about the scripts I have written. I do not consider myself a programmer, I create these little programs as experiments to have a play with the language, or to solve a problem for myself. I would gladly accept pointers from others to improve the code and make it more efficient, or simplify the code. If you would like to make any comments then please feel free to email me at craig@geekcomputers.co.uk.
4+
Here is some more detailed information about the scripts I have written. I do not consider myself a programmer; I create these little programs as experiments to have a play with the language, or to solve a problem for myself. I would gladly accept pointers from others to improve the code and make it more efficient, or simplify the code. If you would like to make any comments then please feel free to email me at craig@geekcomputers.co.uk.
55

66
In the scripts the comments etc are lined up correctly when they are viewed in [Notepad++](https://notepad-plus-plus.org/). This is what I use to code Python scripts.
77

random-sentences.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,26 @@
1515
verb = ["drove", "jumped", "ran", "walked", "skipped"]
1616
preposition = ["to", "from", "over", "under", "on"]
1717

18+
def random_int():
19+
return random.randint(0,4)
1820

1921
def random_sentence():
2022
"""Creates random and return sentences."""
21-
22-
sentence = ""
23-
sentence += article[random.randint(0, 4)] + " " + noun[random.randint(
24-
0, 4)] + " "
25-
sentence += verb[random.randint(0, 4)] + " " + preposition[random.randint(
26-
0, 4)] + " "
27-
sentence += article[random.randint(0, 4)] + " " + noun[random.randint(
28-
0, 4)] + ". "
29-
sentence = sentence[0].upper() + sentence[1:]
30-
31-
return sentence
32-
33-
23+
return ("{} {} {} {} {} {}"
24+
.format(article[random_int()]
25+
,noun[random_int()]
26+
,verb[random_int()]
27+
,preposition[random_int()]
28+
, article[random_int()]
29+
,noun[random_int()])).capitalize()
30+
3431
# prints random sentences
35-
for x in range(20):
36-
print(random_sentence())
37-
38-
print()
39-
print()
32+
for sentence in list(map(lambda x: random_sentence(), range(0, 20))):
33+
print(sentence)
34+
35+
print("\n")
4036

41-
# creates short story
42-
story = ""
43-
for x in range(20):
44-
story += random_sentence()
37+
story = (". ").join(list(map(lambda x: random_sentence(), range(0, 20))))
4538

46-
print(story)
39+
# prints random sentences story
40+
print("{}".format(story))

test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is an test file for update my project to github.

0 commit comments

Comments
 (0)