Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ziphyr.xyeag@gmail.com #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions task1.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import random
import random

ourList = list()
count = 0
num = 5
count = 0
while (count < 11):
ourList.append(random.randint(1,10))
ourList.append(random.randint(1,10)) # generates ten random numbers
count += 1

ourList

# we assign belowFive numbers in ourList below 5
belowFive = [i for i in ourList if i < num]

#print numbers below five
print (belowFive)
11 changes: 10 additions & 1 deletion task2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@
words = [word.rstrip('\n') for word in open('words.txt')]
randomPhrase = " ".join([words[random.randrange(0, len(words))] for i in range(4)])

randomPhrase
#reversing the words
reversePhrase = randomPhrase[::-1]

# output for random words
print("Words in normal Display: ")
print(randomPhrase)
print("-" * 30)
# output for reverse of random words
print("Words in reverse Display: ")
print (reversePhrase)