# HELP with syntax

I need help with this problem? I seem to have the data arrays printing but it doesn’t come out correctly. I am using Python 3.0.

These are two data arrays, representing
#total time spent on assignments in a course weekly, and numeric grades of students.
#However, I have intentionally added error to the numbers.
#Using a random uniform distribution, add or subtract a value between
#0 and 4 to hours spent, and 0 to 10 to each numeric grade.
#Plot the regression line for your simulated data (one time only).

import warnings
warnings.filterwarnings(‘ignore’)

time_spent_in_course=[5, 7, 8, 10, 16, 5, 5, 7, 8, 20]
numeric_grade = [80, 85, 85, 90, 90, 90, 75, 75, 85, 75]

import random
random_hour = random.uniform(0,4)
print(‘Time spent will be subtracted by:’)
print(random_hour)

What do you want to ignore?

Ignore errors. I don’t think the code is necessary, but this is what i have. This should be clean code? It came out with data but I am not 100% if it was correct data.

mport warnings
warnings.filterwarnings(‘ignore’)

time_spent_in_course=[5, 7, 8, 10, 16, 5, 5, 7, 8, 20]
numeric_grade = [80, 85, 85, 90, 90, 90, 75, 75, 85, 75]

import random
random_hour = random.uniform(0,4)
print(‘Time spent will be subtracted by:’)
print(random_hour)
#The value will be subtracted from the random value generated from the list. In this case, it will be the from the time spent in the course

updated_time_spent_in_course = [x - random_hour for x in time_spent_in_course]

print(‘The new times spent will be:’)
print (updated_time_spent_in_course)

#This will subtracting this randomly generated value from the list grade.

import pandas

matplotlib.pyplot.figure()
seaborn.regplot(x=‘Time Spent in Course’, y=‘Grade’, data = all_data)

May we assume the goal here is to generate a random float?

``````>>> import random
>>> round(random.uniform(0, 4), 2)
2.35    # GPA format
>>> round(random.uniform(0, 4), 3)
2.353   # secondary sigdig in further calculations
>>>
``````

Aside

Of course this is staged. But the above is to be expected output, which is demonstrated. (QED?)

I modified the code completely. I guess to provide more context

I was provided two data arrays, and I have to find

``````#total time spent on assignments in a course weekly, and numeric grades of students.
#However, I have intentionally added error to the numbers.
#Using a random uniform distribution, add or subtract a value between
#0 and 4 to hours spent, and 0 to 10 to each numeric grade.
#Plot the regression line for your simulated data (one time only).
``````

My code is as follows.

``````time_spent_in_course=[5, 7, 8, 10, 16, 5, 5, 7, 8, 20]
numeric_grade = [80, 85, 85, 90, 90, 90, 75, 75, 85, 75]

import numpy as np

counter = 1
list_of_timevariation = list()
while counter <= 10:
list_of_timevariation.append(random.uniform(-4,4))
counter = counter + 1

timevariationarray = np.array(list_of_timevariation)

print("Time Spent in Course:")
print(time_final)

matplotlib.pyplot.figure()
seaborn.regplot(x='Time Spent in Course', y='Numeric Grade', data = all_data
``````

The syntax was correct, but not it comes up with an error.

Hopefully, somebody familiar with data science will pipe in. I am not set up to test this code but I did check the syntax…

The very last line is missing a closing paren, `)`.

``````random