Answers to Exercises Python Basics

Hello,

Currently on Control Flow in Python Basics and would like to verify my answers, are there any answer sheets for the whole section of Python Basics?

Thank you,
Pat

Hi @PatL , could you please be a bit more specific? For example, send a link to an exercise that doesn’t have a solution?

Well if it’s not possible to have a solution sheet to verify the work… in exercises 8 & 9 in control flow, I wrote this as a solution and wanted to verify it:
#8:
import numpy as np
x = np.random.rand(10_000)
for i in range(len(x)):
if x[i] > 0.999:
print(i)
break
#9
import numpy as np
x = np.random.rand(10_000)
total = 0
for i in x:
if i >= 0.5:
total += i
else:
continue
print(total)

Thanks for your time.

Online or PDF lectures? If online, please provide a link to the exercise. If PDF, please give a date on the front of PDF and page number of the exercise.

Through jupyter labs, found the link online:

Hi @PatL Sadly, we have the capacity to check the answers, but I believe stackoverflow can help. There is a homework policy here: How do I ask and answer homework questions? - Meta Stack Overflow