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
Leya [2.2K]
3 years ago
11

Write a program using integers userNum and x as input, and output userNum divided by x three times.

Computers and Technology
1 answer:
andrezito [222]3 years ago
7 0

Answer:

# The user is prompted to enter number as dividend

# The received number is assigned to userNum

userNum = int(input("Enter the number you want to divide: "))

# The user is prompted to enter number as divisor

# The divisor is assigned to x

x = int(input("Enter the number of times to divide: "))

# divideNumber function is defined to do the division

def divideNumber(userNum, x):

   # counter is declared to control the loop

   counter = 1

   # the while-loop loop 3 times

   # the division is done 3 times

   while counter <= 3:

       # integer division is done

       # truncating the remainder part

       userNum = userNum // x

       # the result of the division is printed

       print(userNum, end=" ")

       # the counter is incremented

       counter += 1

# the divideNumber function is called

# the received input is passed as parameter

# to the function

divideNumber(userNum, x)

# empty line is printed

print("\n")

Explanation:

The // operator in python works like the / operator in C. The // operator returns only the integer part of division operation. For instance 6 // 4 = 1. The fraction part is discarded.

You might be interested in
A 10 Superscript negative 910−9​-F capacitor ​(11 nanofaradnanofarad​) is charged to 5050 V and then disconnected. One can model
vredina [299]

Answer:

Explanation:

i) On a cold day, Capacity = (66 X 910 X 10∧-9) F

Charge, Q = (66 X 910 X 10∧-9) X 5050 = 0.30 Columb

Current, I= 5050/131013 = 0.039 Amp (where Resistance = 131013 ohms)

Time, t= 0.30/0.039 = 7.7 seconds

ii) On a humid day, Capacity = (77 X 910 X 10∧-9) F

Charge, Q = ( 77 X 910 X 10∧-9) X 5050 = 0.35 Columb

Current, I= 5050/6106 = 0.83 Amp ( where Resistance = 6106 ohms)

Time, t= 0.35/0.83 = 0.42 h or  0.42 X 60 mins = 25 mins

7 0
3 years ago
What is a set of javascript statements that result in an action?
AlexFokin [52]

function is the right answer because function is a block of code designed to perform a particular task

4 0
3 years ago
What is your F O R T N I T E name
kolbaska11 [484]

Answer:

don't have name, but would be something cool.

Explanation:

poor, have a splendid day.

6 0
3 years ago
Read 2 more answers
Modify the WordCount program so it outputs the wordcount for each distinct word in each file. So the output of this DocWordCount
stepladder [879]

Answer and Explanation:

package PackageDemo;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Job;

import org.apache.hadoop.mapreduce.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;

public class WordCount {

public static void main(String [] args) throws Exception

{

Configuration c=new Configuration();

String[] files=new GenericOptionsParser(c,args).getRemainingArgs();

Path input=new Path(files[0]);

Path output=new Path(files[1]);

Job j=new Job(c,"wordcount");

j.setJarByClass(WordCount.class);

j.setMapperClass(MapForWordCount.class);

j.setReducerClass(ReduceForWordCount.class);

j.setOutputKeyClass(Text.class);

j.setOutputValueClass(IntWritable.class);

FileInputFormat.addInputPath(j, input);

FileOutputFormat.setOutputPath(j, output);

System.exit(j.waitForCompletion(true)?0:1);

}

public static class MapForWordCount extends Mapper<LongWritable, Text, Text, IntWritable>{

public void map(LongWritable key, Text value, Context con) throws IOException, InterruptedException

{

String line = value.toString();

String[] words=line.split(",");

for(String word: words )

{

Text outputKey = new Text(word.toUpperCase().trim());

IntWritable outputValue = new IntWritable(1);

con.write(outputKey, outputValue);

}

}

}

public static class ReduceForWordCount extends Reducer<Text, IntWritable, Text, IntWritable>

{

public void reduce(Text word, Iterable<IntWritable> values, Context con) throws IOException, InterruptedException

{

int sum = 0;

for(IntWritable value : values)

{

sum += value.get();

}

con.write(word, new IntWritable(sum));

}

}

}

8 0
3 years ago
During which part of an examination are various body parts and organs touched and felt?
scoray [572]

The correct answer is B. Palpation

Explanation:

In a medical exam or similar, the palpation involves touching different parts of the body to feel the organs and structures in this. This process is essential in diagnosis because palpation can reveal inflammation, pain in certain areas, or abnormalities. Additionally, palpation requires a broad knowledge of anatomy that allows health professionals to understand the structures of the body when they touch these and how to determine abnormalities. Thus, the part of an examination in which body parts are touched and felt is palpation.

8 0
3 years ago
Other questions:
  • In an ha configuration, which two failure detection methods rely on icmp ping? (choose two.)
    12·1 answer
  • Anti-bullying laws in most states are designed to provide
    14·2 answers
  • What does the group on option do?
    10·1 answer
  • Tiffany is an instructor at a college that is run on student tuition and not state taxes. Which statement best describes her emp
    6·2 answers
  • Managing your calendar and emails can be easily accomplished through ___ software
    8·1 answer
  • Which tabs contains options for adding shapes to a chart ? Check all that apply.
    13·1 answer
  • Question 5 (1 point)
    5·1 answer
  • What does it mean by MYRIAD of data?
    9·1 answer
  • Inserting and deleting text is a basic editing task in word processing.<br><br> True or false
    6·2 answers
  • After you have located a program name from the Start menu, in order to create a shortcut on the desktop.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!