Skip to content
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
28 changes: 27 additions & 1 deletion week_0/ex_0_advanced/ex_0_advanced_runfile.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful work here. My only small critique would be to convert seq to seq.upper( ) to handle if the user types in lowercase atcg values. Other than that, very good implementation.

Score: 2/2

Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
#YOUR CODE FOR EX_0 ADVANCED HERE

#GTCGATAACTAGCTAACGGCT

def DNA_sequence_analysis(seq):

count_A = seq.count("A")
count_C = seq.count("C")
count_G = seq.count("G")
count_T = seq.count("T")
GC_tot = count_G + count_C
GC_content = (GC_tot/len(seq)) * 100
print("Adenine count: ",count_A)
print("Cytosine count: ",count_C)
print("Guanine count: ",count_G)
print("Thymine count: ",count_T)
print("GC content is: ", GC_content)


seq = str(input("Enter your DNA sequence: "))
if any(x not in ["A","C","G","T"] for x in seq):
print("Please enter a DNA sequence")
else:
length = len(seq)

print("DNA sequence length: ",length)

print(DNA_sequence_analysis(seq))
4 changes: 2 additions & 2 deletions week_0/ex_0_beginner/ex_0_beginner_runfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import this

print("\n"+"TYPE YOUR RESPONSE TO PROMPT 1 HERE")
print("\n"+"My name is Julien, I am in M2 CARe and I am passionate about cancer research. Programming is getting really important in that field due to the amount of data that need analysis or prediction.")

print("\n"+"TYPE YOUR RESPONSE TO PROMPT 2 HERE")
print("\n"+"I don't recall any.")
27 changes: 27 additions & 0 deletions week_0/ex_0_beginner/ex_0_beginner_submit.txt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works well for the setup on your end.

Score: 0.5/0.5

Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
Copy and paste output of ex_0_beginner_runfile.py below:
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

My name is Julien, I am in M2 CARe and I am passionate about cancer research. Programming is getting really important in that field due to the amount of data that need analysis or prediction.

I don't recall any.

Process finished with exit code 0
19 changes: 18 additions & 1 deletion week_0/ex_0_intermediate/ex_0_intermediate_runfile.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very excellent work on implementing both the cell rate calculator and the conditionals to vet correct user input.

Score: 1.5/1.5

Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
#YOUR CODE FOR EX_0 INTERMEDIATE HERE
import math

initial_count = input("Enter the initial cell count: ")
final_count = input("Enter the final cell count: ")
time = input("Enter the time elapsed: ")

try:
initial_count = int(initial_count)
final_count = int(final_count)
time = float(time)
if initial_count <= 0 or final_count <= 0 or time <= 0:
print("You must enter a positive number")

else:
growth_rate = (math.log(final_count) - math.log(initial_count)) / time
print(growth_rate)
except ValueError:
print("Invalid input, please enter integer values for initial_count and final_count")
24 changes: 24 additions & 0 deletions week_1/ex_1_beginner/ex_1_beginner_submit.txt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent implementation here with all objectives complete. My only recommendation is to take a look at where you print the global output of the stats function without returning a variable to be printed, so then it results in the word "None" being printed to the console. Since you already print the desired output within your function, there is no need to print twice. Likewise, you could have also returned each one of the local variables created in def stats separately as a list and then iterated through the list globally to print each of the outputs.

Score: 0.5/0.5

Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
Copy and paste output of ex_1_beginner_runfile.py below:

#First we define a function "stats" that will calculate the average population count and print the max and min population count

def stats(population_counts):
total_population = sum(population_counts)
average_population = total_population/ len(population_counts)
max_population = max(population_counts)
min_population = min(population_counts)
print("Average population count: ",average_population)
print("Maximum population count: ",max_population)
print("Minimum population count: ",min_population)

#we then enter our population count data and apply to it the function that we defined above.

population_counts = [100, 200, 150, 300, 50]
print(stats(population_counts))

#we create a loop using the function enumerate, this function will give the value (called here "population count") aswell as the index (called here "x") corresponding to that value. We setup the starting index as 1 (as day 1).
# If the population count is above 200, the index will be printed (here day 4) and the loop continue.

print("Days when the population exceeds 200: ")
for x,population_count in enumerate(population_counts, start=1):
if population_count>200:
print("Day ", x)
33 changes: 33 additions & 0 deletions week_1/ex_1_intermediate/ex_1_intermediate_submit.txt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good work!

Score: 1.5/1.5

Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
Copy and paste output of ex_1_intermediate_runfile.py below:

#first we define a dictionary of species with counts
microbial_species = {"Bacteria": 20, "Archaea": 15, "Fungi": 10}

#create a function that add up the species entries counts. Or define a new count starting at 1 if the species is new. Species dictionary being at first microbial_species
def add_species_to_dictionary(species_dictionary, new_species):
if new_species in species_dictionary:
species_dictionary[new_species] +=1
else:
species_dictionary[new_species] = 1

#loop asking user to enter a species or end the loop. The species entered will add to dictionary names and counts.
# I thought this step and the one above made more sense added first into the code as the user will first enter his species and then see the result.
while True:
new_species=input ("Enter a species name or 'end' if you want to stop adding species: ")
if new_species== 'end':
break
add_species_to_dictionary(microbial_species,new_species)

#printing species' names and samples' count from the dictionary
for species, count in microbial_species.items():
print(f"{species}: {count} samples")

#adding up all samples counts
total_samples= sum(microbial_species.values())
print("Total number of samples from all species combined: ", total_samples)

#asking to print species from dictionary with count over 15
samples_over_15=[species for species, count in microbial_species.items() if count >15 ]
print ("microbial species with sample counts greater than 15: ", samples_over_15)

#printing the dictionary with samples count
print("Microbial species dictionary: ",microbial_species)