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?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
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("\nQUESTION 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): "))

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)+".")

print("\nThank you for using App!")

print("Closing app...")
 
 
 
 
 
Traceback (most recent call last):
File "/usercode/main.py", line 40, in <module>
CS_377 = str.upper (input ("Have you taken CS377? (Yes or No): "))
EOFError: EOF when reading a line
Transcribed Image Text:Traceback (most recent call last): File "/usercode/main.py", line 40, in <module> CS_377 = str.upper (input ("Have you taken CS377? (Yes or No): ")) EOFError: EOF when reading a line
Traceback (most recent call last):
File "/usercode/main.py", line 35, in <module>
answer_6 = str.upper (input ("Have you taken CS211? (Yes or No): "))
EOFError: EOF when reading a line
Transcribed Image Text:Traceback (most recent call last): File "/usercode/main.py", line 35, in <module> answer_6 = str.upper (input ("Have you taken CS211? (Yes or No): ")) EOFError: EOF when reading a line
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Basics of loop
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education