7.4 code practice question 2 edhesive

The later schools question and answer asked students to state what they ponder is the main important concern for a student to do to be able to achieve success. Out of the many comments, one which that stood out was practice. People who are usually successful do not become successful by being born. They work hard and dedication their lives to succeeding. This is how you can reach your goals. in the following paragraphs some question and answer examples that you would possibly implement to elevate your knowledge and gain insight that will help you to maintain your school studies.

Question:

7.4 code practice question 2 edhesive

Answer:

The code practice question illustrates the use of conditional statements.

The execution of a conditional statement depends on its truth value

The program in Python, where comments are used to explain each line is as follows:

#Start by initializing the dictionary

dict = {“a”: 4, “b”: 3, “c”: 2, “d”: 1, “f”: 0}

#This gets input for grade

grade = input().lower()

#This gets input for the weighted average

weighted = int(input())

#If the weighted average is 1, and the grade is in the dictionary

if weighted == 1 and grade in dictionary:

   #This prints the GPA score

   print(“Your GPA score is: “+str(dict[grade] + 1))

#If the weighted average is 0, and the grade is in the dictionary

elif weighted == 0 and grade in dictionary:

   print(“Your GPA score is : “+str(dict[grade]))

#Otherwise

else:

   #The grade is invalid

   print(“Invalid”)

Read more about similar programs at:

READ MORE  What are the domain and range of the function below?

They can potentially hopefully guide the student solve the question by obtaining the questions and answer examples. Then could certainly carry out some sharing in a group discussion and also learning with the classmate somewhere around the topic, so another student also ought to have some enlightenment and still keeps up the school learning.

Leave a Reply

Your email address will not be published.