answer.
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
Aleonysh [2.5K]
2 years ago
13

How to write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator).

Your program should then divide the numerator by the denominator, and display the quotient followed by the remainder in python.
Computers and Technology
1 answer:
fomenos2 years ago
3 0

Answer:

num1 = int(input("Numerator: "))

num2 = int(input("Denominator: "))

if num1 < 1 or num2<1:

     print("Input must be greater than 1")

else:

     print("Quotient: "+str(num1//num2))

     print("Remainder: "+str(num1%num2))

Explanation

The next two lines prompts the user for two numbers

<em>num1 = int(input("Numerator: "))</em>

<em>num2 = int(input("Denominator: "))</em>

The following if statement checks if one or both of the inputs is not positive

<em>if num1 < 1 or num2<1:</em>

<em>      print("Input must be greater than 1")-> If yes, the print statement is executed</em>

If otherwise, the quotient and remainder is printed

<em>else:</em>

<em>      print("Quotient: "+str(num1//num2))</em>

<em>      print("Remainder: "+str(num1%num2))</em>

<em />

You might be interested in
Implement the function couple, which takes in two lists and returns a list that contains lists with i-th elements of two sequenc
In-s [12.5K]

Answer:

couple.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

s1=[1,2,3]

s2=[4,5,6]

print(couple(s1,s2))

enum.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

def enumerate(s,start=0):

  number_Array=[ i for i in range(start,start+len(s))]

  return couple(number_Array,s)

s=[6,1,'a']

print(enumerate(s))

print(enumerate('five',5))

Explanation:

7 0
2 years ago
Carrie works on a help desk and is assigned a ticket that was automatically generated by a server because of an error. The error
mixas84 [53]

The windows tool of weapon of choice that Carrie will use to troubleshoot the server is Powershell. All those GUI consoles built by Microsoft for Windows, by default, execute Powershell commands behind the scenes. Every possible thing that Carrie can do with the physical server can easily be accessible through Powershell's command line interface

Further Explanation

I would honestly say that there are a few available tools that Carrie can use, but the best tool is the inbuilt Windows Powershell. As Powershell continues to extend its purpose and usefulness, Microsoft, on the other hand, continues to use Powershell's capability to develop more cmdlets for products like Windows Servers.

Everything that can be done in a GUI environment can be done in Powershell. Carrie should be able to use Powershell to run things more efficiently from the command line without stepping a foot on the physical server. She will only need to access the server from her desk remotely, run a few commands, and that is it. Powershell command line is so powerful; it carries with it every troubleshooting pack that you can think about.

Learn More

brainly.com/question/10178399

brainly.com/question/10338479

#LearnWithBrainly

5 0
2 years ago
Read 2 more answers
This question involves the creation of user names for an online system. A user name is created based on a user’s first and last
Evgen [1.6K]

Answer:

See explaination

Explanation:

import java.util.*;

class UserName{

ArrayList<String> possibleNames;

UserName(String firstName, String lastName){

if(this.isValidName(firstName) && this.isValidName(lastName)){

possibleNames = new ArrayList<String>();

for(int i=1;i<firstName.length()+1;i++){

possibleNames.add(lastName+firstName.substring(0,i));

}

}else{

System.out.println("firstName and lastName must contain letters only.");

}

}

public boolean isUsed(String name, String[] arr){

for(int i=0;i<arr.length;i++){

if(name.equals(arr[i]))

return true;

}

return false;

}

public void setAvailableUserNames(String[] usedNames){

String[] names = new String[this.possibleNames.size()];

names = this.possibleNames.toArray(names);

for(int i=0;i<usedNames.length;i++){

if(isUsed(usedNames[i],names)){

int index = this.possibleNames.indexOf(usedNames[i]);

this.possibleNames.remove(index);

names = new String[this.possibleNames.size()];

names = this.possibleNames.toArray(names);

}

}

}

public boolean isValidName(String str){

if(str.length()==0) return false;

for(int i=0;i<str.length();i++){

if(str.charAt(i)<'a'||str.charAt(i)>'z' && (str.charAt(i)<'A' || str.charAt(i)>'Z'))

return false;

}

return true;

}

public static void main(String[] args) {

UserName person1 = new UserName("john","smith");

System.out.println(person1.possibleNames);

String[] used = {"harta","hartm","harty"};

UserName person2 = new UserName("mary","hart");

System.out.println("possibleNames before removing: "+person2.possibleNames);

person2.setAvailableUserNames(used);

System.out.println("possibleNames after removing: "+person2.possibleNames);

}

}

8 0
2 years ago
When an author produce an index for his or her book, the first step in this process is to decide which words should go into the
Igoryamba

Answer:

import string

dic = {}

book=open("book.txt","r")

# Iterate over each line in the book

for line in book.readlines():

   tex = line

   tex = tex.lower()

   tex=tex.translate(str.maketrans('', '', string.punctuation))

   new = tex.split()

   for word in new:

       if len(word) > 2:

           if word not in dic.keys():

               dic[word] = 1

           else:

               dic[word] = dic[word] + 1

for word in sorted(dic):

   print(word, dic[word], '\n')

                 

book.close()

Explanation:

The code above was written in python 3.

<em>import string </em>

Firstly, it is important to import all the modules that you will need. The string module was imported to allow us carry out special operations on strings.

<em>dic = {} </em>

<em>book=open("book.txt","r") </em>

<em> </em>

<em># Iterate over each line in the book</em>

<em>for line in book.readlines(): </em>

<em> </em>

<em>    tex = line </em>

<em>    tex = tex.lower() </em>

<em>    tex=tex.translate(str.maketrans('', '', string.punctuation)) </em>

<em>    new = tex.split() </em>

<em />

An empty dictionary is then created, a dictionary is needed to store both the word and the occurrences, with the word being the key and the occurrences being the value in a word : occurrence format.

Next, the file you want to read from is opened and then the code iterates over each line, punctuation and special characters are removed from the line and it is converted into a list of words that can be iterated over.

<em />

<em> </em><em>for word in new: </em>

<em>        if len(word) > 2: </em>

<em>            if word not in dic.keys(): </em>

<em>                dic[word] = 1 </em>

<em>            else: </em>

<em>                dic[word] = dic[word] + 1 </em>

<em />

For every word in the new list, if the length of the word is greater than 2 and the word is not already in the dictionary, add the word to the dictionary and give it a value 1.

If the word is already in the dictionary increase the value by 1.

<em>for word in sorted(dic): </em>

<em>    print(word, dic[word], '\n') </em>

<em>book.close()</em>

The dictionary is arranged alphabetically and with the keys(words) and printed out. Finally, the file is closed.

check attachment to see code in action.

7 0
2 years ago
A distribution of software that simplifies administration by identifying dependencies, automatically updating configuration file
emmasim [6.3K]

Answer:

Package

Explanation:

In a conventional kind of definition, a software package is basically several applications or code modules that work hand-in-hand to meet a range of goals and objectives. One of the most well-known examples is package like the Microsoft Office package, which consist of individual applications such as Excel, Word, Access and PowerPoint.

It can also be said to be numerous individual files or resources that are packed together as a software set which is meant to provides specific functionality as part of a larger system.

6 0
2 years ago
Other questions:
  • A router is involved in ____________ layers of the tcp/ip protocol suite.
    12·1 answer
  • One reason for using social media is to develop social and professional contacts. True or false?
    9·2 answers
  • True or false? The largest component of a database is a field.
    12·2 answers
  • Can someone please help me with this
    9·1 answer
  • What is a typical grace period for a credit card...
    15·2 answers
  • ______ is a certification program that recognizes sustainable building practices and strategies. Question 1 options: A) Brundtla
    10·1 answer
  • Your friend Margo is considering what type of display to purchase with her new desktop computer and she asks you for advice. You
    14·1 answer
  • Jennifer has written a short story for children. What should be her last step before she submits the story for publication?
    11·1 answer
  • This program will output a right triangle based on user specified height triangle_height and symbol triangle_char. (1) The given
    9·1 answer
  • Consider a disk that rotates at 3600 rpm. The seek time to move the head between adjacent tracks is 2 ms. There are 32 sectors p
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!