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]
2 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]2 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
Super easy question but you have to think about it because it’s not that easy I’ll mark brainliest for first answer Explain the
kkurt [141]

Answer:

Databases are not that simple. Now we not only have a Data warehouse, but we also have the Data Lake as well. We also have NoSQL and SQL form of support with these modern databases. The JSON format is rocking. You can hence through JSON store the text, image, audio, video, etc in one go. And like the first five can be a text, the next five can be an image then again a text than video, and so on. And it is super easy to access them as well. Also, you can edit them quite easily as well. It's not that hard like the Lisp used to be in the past. And supermarket has a mix blend of the database. And modern databases like Data Lake can be very useful, undoubtedly.

You can store security type of requirements, like CCTV footage, each shop details like shop ID, Product list, shop type, electricity bill, hours of opening, floor, facilities, no. of employees, etc., and like this, we can have the details for the entire supermarket, and each shop there definitely. And we can perform various actions on behalf of each shop and market as well. The database can hence be very useful definitely

Explanation:

Please check the answer.

8 0
3 years ago
MULTI SELECTION
GaryK [48]

Answer:

A. Click on the Print icon at the top of the screen

Explanation:

8 0
2 years ago
Use the table on the right to convert from binary to decimal.
postnew [5]

Answer:

There is no table, so I can only comment on the statements:

The binary value of decimal 10 is A.  ==> False, however A is a hexadecimal representation of 10.

The binary value of decimal 13 is 1001  ==> False, 13 would be 1101.

The binary value of decimal 15 is 1111.  ==> True.

The binary value of decimal 14 is E. ==> Again E is a hexadecimal representation of 14.

7 0
2 years ago
Read 2 more answers
8.5 question 2 edhesive
dangina [55]

Answer:

Please check the attachment.

Explanation:

Please check the attachment for the program in python.

Download txt
5 0
3 years ago
Write a program that first calls a function to calculate the square roots of all numbers from 1 to 1,000,000 and write them to a
svlad2 [7]

Answer:

The csharp program to compute square roots of numbers and write to a file is as follows.

class Program  

{  

static long max = 1000000;  

static void writeRoots()  

{  

StreamWriter writer1 = new StreamWriter("roots.txt");  

double root;  

for (int n=1; n<=max; n++)  

{  

root = Math.Sqrt(n);  

writer1.WriteLine(root);  

}  

}  

static void Main(string[] args)  

{  

writeRoots();  

}  

}

The program to compute squares of numbers and write to a file is as follows.

class Program  

{  

static long max = 1000000;  

static void writeSquares()  

{  

StreamWriter writer2 = new StreamWriter("squares.txt");  

long root;  

for (int n = 1; n <= max; n++)  

{  

root = n*n;  

writer2.WriteLine(root);  

}  

}  

static void Main(string[] args)  

{  

writeSquares();  

}  

}  

Explanation:

1. An integer variable, max, is declared to hold the maximum value to compute square root and square.

2. Inside writeRoots() method, an object of StreamWriter() class is created which takes the name of the file as parameter.

StreamWriter writer1 = new StreamWriter("roots.txt");

3. Inside a for loop, the square roots of numbers from 1 to the value of variable, max, is computed and written to the file, roots.txt.

4. Similarly, inside the method, writeSquares(), an object of StreamWriter() class is created which takes the name of the file as parameter.

StreamWriter writer2 = new StreamWriter("squares.txt");

5. Inside a for loop, the square of numbers from 1 to the value of the variables, max, is computed and written to the file, squares.txt.

6. Both the methods are declared static.

7. Inside main(), the method writeRoots() and writeSquares() are called in their respective programs.

8. Both the programs are written using csharp in visual studio. The program can be tested for any operation on the numbers.

9. If the file by the given name does not exists, StreamWriter creates a new file having the given name and then writes to the file using WriteLine() method.

10. The csharp language is purely object-oriented language and hence all the code is written inside a class.

3 0
3 years ago
Other questions:
  • âwhat two log files are used by older versions of unix and newer version of linux to store log information
    10·2 answers
  • Nick’s computer has been restarting on its own. what action should he take to solve this issue?
    14·1 answer
  • In Python,The sum of the elements in a tuple can be recusively calculated as follows:The sum of the elements in a tuple of size
    5·1 answer
  • What would be one duty of a network administrator
    12·1 answer
  • A Windows application which demands a lot of raw processing power to execute repetitive complex calculations is a good candidate
    5·1 answer
  • Mary feels confident managing Google Search campaigns and is interested in extending her marketing reach with the help of Google
    10·1 answer
  • Some websites are dedicated to cataloguing information. Since these sites contain so much data, these sites are usually organize
    11·2 answers
  • Describe how learning can be accessed in your class?​
    14·1 answer
  • What is a personal data?
    12·1 answer
  • How would you use keywords and Boolean operators to help you with a web search?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!