Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CAn anyone help with this, I need a Python code that works, as well as a PsuedoC

ID: 3715077 • Letter: C

Question

CAn anyone help with this, I need a Python code that works, as well as a PsuedoCode. I am using Python 3.6 If you are going to solve please follow all guidelines listed.

Write a program that does the following.

Create a function genNumbers that uses a loop to generate 10 random numbers between 1-10 and add them to a list called numList. Display a message indicating that all numbers have been generated and assigned to the list. Call the function from def main(). (20 points)

Create a function evalNums that accepts numList and uses a loop to count how many numbers in the list are 6 or greater and how many are 5 or less.   Display messages in the following form after all numbers have been evaluated: (20 points).

7 of the numbers are 6 or greater.
3 of the numbers are 5 or less.

Call the function from def main().

Create a function writeList that accepts numList and writes only the numbers of the list that are 6 or greater to a file called Exam2.dat, one number per line. A new file should be created if a file called Exam2.dat currently exists. Be sure to make all necessary adjustments to each number before writing it to the file. Call the function from def main() (20 points)

Create a function readList that reads contents of the file and displays each number. Be sure to make all necessary adjustments to each number before displaying it. Call the function from def main() (20 points)

Implement the pseudocode as shown (10 points):

Main module

//Call function to generate numbers.
numList = inputNumbers()

//Call function to add numbers
evalNums(numList)

// Write array contents to a file.
writeList(numList)

//Read and display numbers in the file
readList()

End of main module

Submit two files: (10 points)

Your completed Python program.

Your complete Python program as a Word document.

Sample Input/Output

The numbers are generated...

7 numbers are 6 or more

3 numbers are 5 or less

The numbers are written to a file

Here are the numbers in the file...

6

6

10

6

9

10

9

The numbers are generated...

4 numbers are 6 or more

6 numbers are 5 or less

The numbers are written to a file

Here are the numbers in the file...

6

8

8

6

Explanation / Answer

import random
def inputNumbers():
list = []
for i in range(10) :
list.append(random.randint(1,10))
return list
def evalNums(numList):
sum = 0
for i in range(10):
sum+=numList[i]
#print "Sum = " , sum
return
def writeList(numList):
file = open('data.txt','w')
for num in numList:
if num >= 6:
print>>file,num  
return
def readList():
file = open('data.txt','r')
numList = file.read()
print numList
return
#Call function to generate numbers.
numList = inputNumbers()
greatNo = 0
lessNo = 0
for i in range(10) :
num = numList[i]
if num >= 6 :
greatNo = greatNo + 1
else :
  
lessNo = lessNo + 1
print greatNo, "of the numbers are 6 or greater."
print lessNo, "of the numbers are 5 or less"
  
#Call function to add numbers
evalNums(numList)

# Write array contents to a file.
print "The numbers are written to a file"
writeList(numList)

#Read and display numbers in the file
print "Here are the numbers in the file..."
readList()

----------------------------------------------------------------------

//output1

5 of the numbers are 6 or greater.
5 of the numbers are 5 or less
The numbers are written to a file
Here are the numbers in the file...
6
10
6
10
6

------------------------------------

//output2

7 of the numbers are 6 or greater.
3 of the numbers are 5 or less
The numbers are written to a file
Here are the numbers in the file...
10
9
7
9
10
7
9

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote