Write a code to grade the marks obtained by a student in an exam such that if the student has scored above 80% marks give grade A, between 60% to 79% marks give grade B and below 60% marks give grade C.Assignment 2) 1. Write a code to print the multiplication tables from 2 to 25 in the format (2x1=2).2. Write a code to find the stop codons in the following piece of RNA: AAGCGCUGGUAAAAAGAAUAGGAACGGAGCUGCUAAUUUAUAUGACGAUGAAAAUGCCAGAUGGUGUGG(hint: stop codons are UAA, UGA and UAG)
Grading System for Student Marks
Grading System for Student Marks:
# Input marks obtained by the student
marks = float(input("Enter the marks obtained by the student: "))
# Define the grading criteria
if marks >= 80:
grade = 'A'
elif marks >= 60:
grade = 'B'
else:
grade = 'C'
# Display the grade
print(f"The student scored {marks}%, hence gets Grade {grade}.")
Printing Multiplication Tables:
# Printing multiplication tables from 2 to 25
for i in range(2, 26):
for j in range(1, 11):
print(f"{i} x {j} = {i*j}")
Finding Stop Codons in RNA Sequence:
# Given RNA sequence
rna_sequence = "AAGCGCUGGUAAAAAGAAUAGGAACGGAGCUGCUAAUUUAUAUGACGAUGAAAAUGCCAGAUGGUGUGG"
# Define stop codons
stop_codons = ["UAA", "UGA", "UAG"]
# Find stop codons in the RNA sequence
stop_codon_positions = [i for i in range(len(rna_sequence)-2) if rna_sequence[i:i+3] in stop_codons]
# Display stop codon positions
print("Stop codon positions:")
for pos in stop_codon_positions:
print(pos)
Explanation of Provided Codes:
1. The first code segment takes the marks obtained by a student, then assigns a grade (A, B, or C) based on the grading criteria mentioned.
2. The second code segment prints multiplication tables from 2 to 25 in the specified format (e.g., 2 x 1 = 2).
3. The third code segment extracts and displays the positions of stop codons (UAA, UGA, UAG) in the given RNA sequence.
Please note that the provided Python codes demonstrate the functionalities as per the outlined requirements.