From 0ba9a54f3d321f79c84f7cb2b3e79191fe15d0e8 Mon Sep 17 00:00:00 2001 From: nathanielpolley Date: Wed, 9 Oct 2024 12:44:36 +0200 Subject: [PATCH 1/4] I have modified Prompt 1 and 2 and put my answers. I copied and pasted the console to the submit.txt file --- week_0/ex_0_beginner/ex_0_beginner_runfile.py | 4 +-- week_0/ex_0_beginner/ex_0_beginner_submit.txt | 28 +++++++++++++++++++ week_0/lecture_notes_0.py | 8 +++--- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/week_0/ex_0_beginner/ex_0_beginner_runfile.py b/week_0/ex_0_beginner/ex_0_beginner_runfile.py index b3db532..8a50fc3 100644 --- a/week_0/ex_0_beginner/ex_0_beginner_runfile.py +++ b/week_0/ex_0_beginner/ex_0_beginner_runfile.py @@ -1,5 +1,5 @@ import this -print("\n"+"TYPE YOUR RESPONSE TO PROMPT 1 HERE") +print("\n"+"My name is May Hadded, I am 21 years old, I'm a student at CARe. I did my bachelor at the university of Greenwich. I aspire to work for a big skin care firm, discovering new solutions can be done through analysis done with programming tools.") -print("\n"+"TYPE YOUR RESPONSE TO PROMPT 2 HERE") \ No newline at end of file +print("\n"+"The last time I was somewhere without a computer was in a mountain in Turkey.") \ No newline at end of file diff --git a/week_0/ex_0_beginner/ex_0_beginner_submit.txt b/week_0/ex_0_beginner/ex_0_beginner_submit.txt index b4d44a7..dfd73c8 100644 --- a/week_0/ex_0_beginner/ex_0_beginner_submit.txt +++ b/week_0/ex_0_beginner/ex_0_beginner_submit.txt @@ -1 +1,29 @@ Copy and paste output of ex_0_beginner_runfile.py below: +/usr/local/bin/python3.13 /Users/mayhadded/PycharmProjects/CARe_Python_Class_2024/week_0/ex_0_beginner/ex_0_beginner_runfile.py +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 May Hadded, I am 21 years old, I'm a student at CARe. I did my bachelor at the university of Greenwich. I aspire to work for a big skin care firm, discovering new solutions can be done through analysis done with programming tools. + +The last time I was somewhere without a computer was in a mountain in Turkey. + +Process finished with exit code 0 diff --git a/week_0/lecture_notes_0.py b/week_0/lecture_notes_0.py index 66c902f..243a603 100644 --- a/week_0/lecture_notes_0.py +++ b/week_0/lecture_notes_0.py @@ -123,12 +123,12 @@ print("Neither or both x and y are true.") # "not" operator -name = "Maxence" +name = "Nadine" -if not(name == "Anna"): - print("You are not Anna") +if not(name == "Malek"): + print("You are not Malek") else: - print("You are Anna") + print("You are Malek") #Bitwise equivalent (NOT) if name != "Anna": From 84fb73b32cea63dc5991ed43d79e94c4ffb48796 Mon Sep 17 00:00:00 2001 From: mayhadded Date: Thu, 10 Oct 2024 00:32:07 +0200 Subject: [PATCH 2/4] Creation for token file --- week_0/token.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 week_0/token.txt diff --git a/week_0/token.txt b/week_0/token.txt new file mode 100644 index 0000000..fab3995 --- /dev/null +++ b/week_0/token.txt @@ -0,0 +1 @@ +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 \ No newline at end of file From 15ddb226ed8a886f5ffba942ef6979ea6ee2765b Mon Sep 17 00:00:00 2001 From: mayhadded Date: Fri, 18 Oct 2024 00:17:36 +0200 Subject: [PATCH 3/4] Creation for token file --- week_0/ex_0_advanced/ex_0_advanced_runfile.py | 34 ++++++++++++++++++- .../ex_0_intermediate_runfile.py | 29 +++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/week_0/ex_0_advanced/ex_0_advanced_runfile.py b/week_0/ex_0_advanced/ex_0_advanced_runfile.py index ca4c2ba..c267ea4 100644 --- a/week_0/ex_0_advanced/ex_0_advanced_runfile.py +++ b/week_0/ex_0_advanced/ex_0_advanced_runfile.py @@ -1 +1,33 @@ -#YOUR CODE FOR EX_0 ADVANCED HERE \ No newline at end of file +def analyze_dna_sequence(dna_sequence): + # Initialize counts + a_count = dna_sequence.count('A') + c_count = dna_sequence.count('C') + g_count = dna_sequence.count('G') + t_count = dna_sequence.count('T') + + # Calculate total length and GC content + sequence_length = len(dna_sequence) + gc_content = (g_count + c_count) / sequence_length * 100 if sequence_length > 0 else 0 + + # Display results + print(f"Sequence Length: {sequence_length}") + print(f"Adenine (A) Count: {a_count}") + print(f"Cytosine (C) Count: {c_count}") + print(f"Guanine (G) Count: {g_count}") + print(f"Thymine (T) Count: {t_count}") + print(f"GC Content: {gc_content:.2f}%") + + +def main(): + # Prompt user for input + dna_sequence = input("Enter a DNA sequence (A, C, G, T): ").upper() + + # Validate the input + if all(base in 'ACGT' for base in dna_sequence): + analyze_dna_sequence(dna_sequence) + else: + print("Error: Invalid DNA sequence. Please use only A, C, G, and T.") + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/week_0/ex_0_intermediate/ex_0_intermediate_runfile.py b/week_0/ex_0_intermediate/ex_0_intermediate_runfile.py index 919a326..8928304 100644 --- a/week_0/ex_0_intermediate/ex_0_intermediate_runfile.py +++ b/week_0/ex_0_intermediate/ex_0_intermediate_runfile.py @@ -1 +1,28 @@ -#YOUR CODE FOR EX_0 INTERMEDIATE HERE \ No newline at end of file +import math + +def calculate_growth_rate(): + try: + # Prompt the user to input the initial count, final count, and time + initial_count = float(input("Enter the initial cell count: ")) + final_count = float(input("Enter the final cell count: ")) + time = float(input("Enter the time elapsed (in hours): ")) + + # Validate inputs + if initial_count <= 0 or final_count <= 0: + print("Cell counts must be positive numbers.") + return + if time <= 0: + print("Time must be a positive number.") + return + + # Calculate the growth rate using the formula + growth_rate = (math.log(final_count) - math.log(initial_count)) / time + + # Display the growth rate + print(f"The growth rate of the microbial culture is: {growth_rate:.4f} per hour") + + except ValueError: + print("Invalid input. Please enter numerical values for cell counts and time.") + +# Call the function to run the program +calculate_growth_rate() \ No newline at end of file From 34225e6b5d3c314a771708758b31c692961ad2e6 Mon Sep 17 00:00:00 2001 From: mayhadded Date: Fri, 18 Oct 2024 00:25:35 +0200 Subject: [PATCH 4/4] Creation for token file --- week_0/token.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 week_0/token.txt diff --git a/week_0/token.txt b/week_0/token.txt deleted file mode 100644 index fab3995..0000000 --- a/week_0/token.txt +++ /dev/null @@ -1 +0,0 @@ -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 \ No newline at end of file