Hello, I have been working on this code for a while now and I have encountered difficulties in getting it to function as intended. Can someone help me with this code and how to fix it? The code I currently have is: import math cs_cred = 0 print("--------------------------------") print(" UIC CS Track") print("--------------------------------\n") print("QUESTION 1") answer_1 = str.upper(input("Are you a CS major? (Yes or No): ")) answer_2 = "" answer_3 = "" answer_4 = "" answer_5 = "" answer_6 = "" answer_7 = "" CS_277 = "" CS_377 = "" CS_401 = "" answer_8 = "" if answer_1 == "YES": print("\nQUESTION 2") answer_2 = str.upper(input("Have you taken ENGR100? (Yes or No): ")) if answer_2 == "YES" or "NO": print("\nQUESTION 3") answer_3 = str.upper(input("Have you taken CS111? (Yes or No): ")) if answer_3 == "YES" or "NO": print("\nQUESTION 4") answer_4 = str.upper(input("Have you taken CS141? (Yes or No): ")) if answer_4 == "YES" or "NO": print("\nQUESTION 5") answer_5 = str.upper(input("Have you taken CS151? (Yes or No): ")) if answer_5 == "YES" or "NO": print("\nQUESTION 6") answer_6 = str.upper(input("Have you taken CS211? (Yes or No): ")) if answer_6 == "YES" or "NO": print("\nQUESTION 7") answer_7 = str.upper(input("Have you taken CS251? (Yes or No): ")) CS_277 = str.upper(input("Have you taken CS277? (Yes or No): ")) CS_377 = str.upper(input("Have you taken CS377? (Yes or No): ")) CS_401 = str.upper(input("Have you taken CS401? (Yes or No): ")) if answer_7 or CS_277 or CS_377 or CS_401 == "YES" or "NO": print("\nQUESTION 8") answer_8 = str.upper(input("Have you taken CS261? (Yes or No): ")) print("\n--------------------------------") print(" Summary") print("--------------------------------\n") if answer_1 == "YES": print("You are a CS major!") elif answer_1 == "NO": print("Sadly, you are not a CS major.") if answer_2 == "NO": print("Do not forget to take ENGR100!") if answer_3 == "YES": cs_cred += 3 if answer_4 == "YES": cs_cred += 3 if answer_5 == "YES": cs_cred += 3 if answer_6 == "YES": cs_cred += 3 if answer_7 == "YES": cs_cred += 4 if CS_277 == "YES": cs_cred += 3 if CS_377 == "YES": cs_cred += 3 if CS_401 == "YES": cs_cred += 3 if answer_8 == "YES": cs_cred += 4 if answer_1 == "YES":\ print("\nRequired CS credits earned: " + str(cs_cred)+".") else: # Print the summary for non-CS majors print("\n--------------------------------")
Hello, I have been working on this code for a while now and I have encountered difficulties in getting it to function as intended. Can someone help me with this code and how to fix it? The code I currently have is: import math cs_cred = 0 print("--------------------------------") print(" UIC CS Track") print("--------------------------------\n") print("QUESTION 1") answer_1 = str.upper(input("Are you a CS major? (Yes or No): ")) answer_2 = "" answer_3 = "" answer_4 = "" answer_5 = "" answer_6 = "" answer_7 = "" CS_277 = "" CS_377 = "" CS_401 = "" answer_8 = "" if answer_1 == "YES": print("\nQUESTION 2") answer_2 = str.upper(input("Have you taken ENGR100? (Yes or No): ")) if answer_2 == "YES" or "NO": print("\nQUESTION 3") answer_3 = str.upper(input("Have you taken CS111? (Yes or No): ")) if answer_3 == "YES" or "NO": print("\nQUESTION 4") answer_4 = str.upper(input("Have you taken CS141? (Yes or No): ")) if answer_4 == "YES" or "NO": print("\nQUESTION 5") answer_5 = str.upper(input("Have you taken CS151? (Yes or No): ")) if answer_5 == "YES" or "NO": print("\nQUESTION 6") answer_6 = str.upper(input("Have you taken CS211? (Yes or No): ")) if answer_6 == "YES" or "NO": print("\nQUESTION 7") answer_7 = str.upper(input("Have you taken CS251? (Yes or No): ")) CS_277 = str.upper(input("Have you taken CS277? (Yes or No): ")) CS_377 = str.upper(input("Have you taken CS377? (Yes or No): ")) CS_401 = str.upper(input("Have you taken CS401? (Yes or No): ")) if answer_7 or CS_277 or CS_377 or CS_401 == "YES" or "NO": print("\nQUESTION 8") answer_8 = str.upper(input("Have you taken CS261? (Yes or No): ")) print("\n--------------------------------") print(" Summary") print("--------------------------------\n") if answer_1 == "YES": print("You are a CS major!") elif answer_1 == "NO": print("Sadly, you are not a CS major.") if answer_2 == "NO": print("Do not forget to take ENGR100!") if answer_3 == "YES": cs_cred += 3 if answer_4 == "YES": cs_cred += 3 if answer_5 == "YES": cs_cred += 3 if answer_6 == "YES": cs_cred += 3 if answer_7 == "YES": cs_cred += 4 if CS_277 == "YES": cs_cred += 3 if CS_377 == "YES": cs_cred += 3 if CS_401 == "YES": cs_cred += 3 if answer_8 == "YES": cs_cred += 4 if answer_1 == "YES":\ print("\nRequired CS credits earned: " + str(cs_cred)+".") else: # Print the summary for non-CS majors print("\n--------------------------------")
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter3: Input/output
Section: Chapter Questions
Problem 8SA: What does function sqrt do? Which header file must be included to use the function sqrt? (3)
Related questions
Question
Hello, I have been working on this code for a while now and I have encountered difficulties in getting it to function as intended. Can someone help me with this code and how to fix it?
The code I currently have is:
import math
cs_cred = 0
print("--------------------------------")
print(" UIC CS Track")
print("--------------------------------\n")
print("QUESTION 1")
answer_1 = str.upper(input("Are you a CS major? (Yes or No): "))
answer_2 = ""
answer_3 = ""
answer_4 = ""
answer_5 = ""
answer_6 = ""
answer_7 = ""
CS_277 = ""
CS_377 = ""
CS_401 = ""
answer_8 = ""
if answer_1 == "YES":
print("\nQUESTION 2")
answer_2 = str.upper(input("Have you taken ENGR100? (Yes or No): "))
if answer_2 == "YES" or "NO":
print("\nQUESTION 3")
answer_3 = str.upper(input("Have you taken CS111? (Yes or No): "))
if answer_3 == "YES" or "NO":
print("\nQUESTION 4")
answer_4 = str.upper(input("Have you taken CS141? (Yes or No): "))
if answer_4 == "YES" or "NO":
print("\nQUESTION 5")
answer_5 = str.upper(input("Have you taken CS151? (Yes or No): "))
if answer_5 == "YES" or "NO":
print("\nQUESTION 6")
answer_6 = str.upper(input("Have you taken CS211? (Yes or No): "))
if answer_6 == "YES" or "NO":
print("\nQUESTION 7")
answer_7 = str.upper(input("Have you taken CS251? (Yes or No): "))
CS_277 = str.upper(input("Have you taken CS277? (Yes or No): "))
CS_377 = str.upper(input("Have you taken CS377? (Yes or No): "))
CS_401 = str.upper(input("Have you taken CS401? (Yes or No): "))
if answer_7 or CS_277 or CS_377 or CS_401 == "YES" or "NO":
print("\nQUESTION 8")
answer_8 = str.upper(input("Have you taken CS261? (Yes or No): "))
print("\n--------------------------------")
print(" Summary")
print("--------------------------------\n")
if answer_1 == "YES":
print("You are a CS major!")
elif answer_1 == "NO":
print("Sadly, you are not a CS major.")
if answer_2 == "NO":
print("Do not forget to take ENGR100!")
if answer_3 == "YES":
cs_cred += 3
if answer_4 == "YES":
cs_cred += 3
if answer_5 == "YES":
cs_cred += 3
if answer_6 == "YES":
cs_cred += 3
if answer_7 == "YES":
cs_cred += 4
if CS_277 == "YES":
cs_cred += 3
if CS_377 == "YES":
cs_cred += 3
if CS_401 == "YES":
cs_cred += 3
if answer_8 == "YES":
cs_cred += 4
if answer_1 == "YES":\
print("\nRequired CS credits earned: " + str(cs_cred)+".")
else:
# Print the summary for non-CS majors
print("\n--------------------------------")
print(" Summary")
print("--------------------------------\n")
print("Sadly, you are not a CS major.")
print("\nThank you for using App!")
print("Closing app...")
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning