1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
belka [17]
3 years ago
15

Create a Python program as described below and save it in a file named bool. You should use IDLE or similar environment to creat

e your program. First develop a conceptual model and document it using either pseudo code or a flowchart to meet the requirements of the program described as follows.

Computers and Technology
1 answer:
Eva8 [605]3 years ago
8 0

PYTHON CODE

# function to compare a and b
def compare(a,b):

    # if a is greater than b , return 1
    if a > b:
        return 1

    # if a and b are equal, return 0
    elif a == b:
        return 0

    # if a less than b , return -1
    elif a < b :
        return -1


# testing
if __name__=="__main__":

    # calling the compare function with a and b
    print('compare(5,2) %d'%compare(5,2))
    print('compare(2,5) %d'%compare(2,5))
    print('compare(3,3) %d'%compare(3,3))

    # getting values for a and b
    a=int(input("Enter the value for a: "))
    b=int(input("Enter the value for b: "))

    print('compare(%d,%d) %d'%(a,b,compare(a,b)))

(see attachment for output)

You might be interested in
Difference between Hard copy and Soft copy?​
otez555 [7]

Answer: a hard copy is a printed or physical copy of a document, while a soft copy is a virtual or online copy of the document that is stored on your hard drive or computer.

Explanation:

8 0
3 years ago
The Springfork Amateur Golf Club has a tournament every weekend. The club president
Lera25 [3.4K]

Answer:

The Python code is given below for each question.

Explanation:

1:

 if __name__ == '__main__':

   f = open('golf.txt', 'w')

   n = int(input("Enter number of players:"))

   for i in range(n):

       name = input("Enter name of player number " + str(i + 1) + ":")

       score = int(input("Enter score of player number " + str(i + 1) + ":"))

       f.write(name + "\n" + str(score) + "\n")

   f.close()

2:

try:

   with open('golf.txt') as r:

       lines = r.readlines()

       for i in range(0, len(lines), 2):

           print("Name:", lines[i].strip())

           print("Score:", lines[i+1].strip())

           print()

except FileNotFoundError:

   print("golf.txt is not found!")

6 0
4 years ago
Assume we have two lists, list A and list B. List A contains the numbers [20,10,20], while list B contains the numbers [40,10,30
Tcecarenko [31]

Answer:

5/ 18

Explanation:

Given :

List A: [20,10,20]

List B: [40,10,30,20,40,30]

Chance that number drawn from list A is larger than or equal to that drawn dlfrom list B.

If:

A = 20

B ≤ 20 : [10,20] = 2

A = 10

B ≤ 10 : [10] = 1

A = 20

B ≤ 20 : [10,20] = 2

Probability = Required outcome / Total possible outcomes

Hence,

required outcome = (2 + 2 +1) = 5

Total possible outcomes = 3C1 * 6C1 = (3 * 6) = 18

Hence,

chance that the number we drew from list A is larger than or equal to the number we drew from list B

= 5 / 18

8 0
3 years ago
A spreadsheet is an example of a(n):
zhenek [66]

Answer:

general-purpose application

Explanation:

General purpose application

1. These are software applications which can be used for multiple purposes.

2. These applications perform various tasks as per the need of the user. These tasks can vary in complexity and may or may not be related to each other.

3. These applications are useful for almost all categories of users.

Example include spreadsheets which is a primary application for accounting purpose. It can also be used for to store numerical data or other data in an organized format.

Another use of spreadsheets is visible in data analysis. Graphs and charts can be created based on the given numerical data stored in the spreadsheet. This helps in business growth.

Microsoft Excel and Apple Numbers are spreadsheet applications.

Another example is a word application that can be used to prepare document, reports, and flyers also. Microsoft word is a word processor.

Specialized program

1. These are software applications which can be used for special purpose only.

2. These applications can perform only the task for which it is created.

Examples include windows media player. This application can only run media (audio or video) programs.

System application

1. These include operating system and utility applications.

2. The operating system acts as an interface between the user and the hardware resources of the computer.

For example, Windows is an operating system. It is available in various versions.

3. The computer system and its resources, both software and hardware, are maintained and optimized using utility applications.

Anti-virus is an example of utility applications. It protects the computer resources from virus.

Utility applications

4. The computer system and its resources, both software and hardware, are maintained and optimized using utility applications.

5. These applications are mandatory to smooth functioning of a computer.

For example, disk driver, file manager and back up applications help in managing disks and aid in taking back ups and file management is done by file manager

8 0
3 years ago
Why is the statement if x=y not working in python
Veronika [31]

Answer:

x=1

Explanation:

Re-run your installer (e.g. in Downloads, python-3.8. 4.exe) and Select "Modify". Check all the optional features you want (likely no changes), then click [Next]. Check [x] "Add Python to environment variables", and [Install]

8 0
2 years ago
Other questions:
  • The word biodegradable on a label doesn't necessarily mean a product is environmentally safe?
    12·1 answer
  • you'll be organizing the various databases in your organization, and have recommended hiring a/an?A. internet specialist B. comp
    6·2 answers
  • А.<br> is the highest education degree available at a community college.
    6·1 answer
  • The ____ command is used to disconnect a datatable object from the database. (
    15·2 answers
  • Destinguish between qualitative data and quantitave
    12·1 answer
  • of the menu items listed at the top of the screen, which will be used to determine what the shortcut f6 means in primesuite?
    5·1 answer
  • A virus that is embedded in the automatically executing scipts commonly found in word processors, spreadsheets, and database app
    13·2 answers
  • What file name would allow you to easily find and edit your document later in Word Online?
    14·2 answers
  • To override a method in a subclass, the method must be defined in the subclass using the same signature and compatible return ty
    12·1 answer
  • What is an html skeleton? If you know what it is can you write it for me?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!