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
larisa86 [58]
3 years ago
9

Ask the user to enter a number n >= 1. There after the user will enter n-1 distinct integers between 1 and n. Thus, the enter

ed numbers contain all numbers between 1 and n except one. Output the missing number. You are not allowed to use lists. You are also not allowed to use dictionaries or any programming concept more advanced that a loop. The numbers entered can be in any order.
Computers and Technology
1 answer:
snow_tiger [21]3 years ago
3 0

Answer:

Code below

Explanation:

n = int(input('Please enter n: '))#take input n

print('please enter the numbers')#print enter the numbers

total = 0 #intially take total as 0

original_total = 1 #intially take original_total=1

for i in range(2, n+1): #take the range 2 to n+1

total += int(input('Please enter a number: ')) # add total and enter the number

original_total += i

missing = original_total - total #you got missing number original_total - total

print('The missing number is: ' + str(missing)) # print missing number in the given data

You might be interested in
Design and implement a class called Sphere that contains instance data that represent the sphere’s diameter. Define the Sphere c
Zolol [24]

Answer:

Import java.awt.*;

import java.util.*;

public class Sprhere

{// Instance Data private double surfaceA, volume, r, diameter; //Constructors public Sphere ()

{r = 0;diameter = 0; surfaceA = 0;volume = 0;}

public Sphere (double radius, double d, double SA, double v)

{this. r = radius; this. diameter = d; this. surfaceA = SA;this.volume = v;}

//--------------------------------------------------------------------// Accesors.//--------------------------------------------------------------------public double get Radius()

{return r;}

public double get Diameter()

{return diameter;}

public double get SurfaceA()

{return surfaceA;}

public double get Volume()

{return volume;}

//--------------------------------------------------------------------// Mutators.//--------------------------------------------------------------------

3 0
3 years ago
Any idea how to make my simple python projects such as guess the number, mad libs, etc. even better?
-Dominant- [34]

Answer: Person's name.

Explanation:

3 0
2 years ago
Read 2 more answers
8.2 code practice edhesive?
Illusion [34]

Answer:

temperatures = []

i = 0

while i < 5:

   try:

       t = int(input('Enter a temperature: '))

       temperatures.append(t)

       i += 1

   except ValueError:

       print('Enter a number')

print(temperatures)

Explanation:

Hope this helps!

6 0
3 years ago
When web developers specify color values for text or backgrounds, they often represent RGB (red-green-blue) colors using a six-d
neonofarm [45]

Answer: A #3f107f.

Letter B would produce a lighter blue-purple color rather than a darker shade of purple. Letter C would produce a very light purple color. Letter D would produce a Black color, making it very dark and not in the range of being purple.

Letter A would produce a darker shade of purple. As explained in the way that the RGB color hexadecimal uses, the amount of each respective color is 2 digits for each color Red, Green, Blue respectively.  By reducing the amount of each color in the RGB mode, the output will become a darker shade as the RGB mode is an ADDITITIVE type of color mode.

7 0
3 years ago
Bends are made in pvc conduit using a tool known as a
USPshnik [31]
The answer is C) heater box
8 0
3 years ago
Read 2 more answers
Other questions:
  • What is intensity? this is for digital arts
    12·1 answer
  • If you are upgrading your operating system to Windows 7, you may not use the In-Place Upgrade Installation Option with
    14·1 answer
  • What does nntp stand for?
    12·2 answers
  • What do you call the process of translating statements written by a developer? What is the result of this process?
    6·1 answer
  • Amazon SWF is restricts you to use a specific programming language when setting up a work flow
    8·1 answer
  • For almost all networks today, including the internet, the communication protocol used is called ____.
    15·1 answer
  • A user contacted the help desk to report that the laser printer in his department is wrinkling the paper when printed. The user
    5·1 answer
  • . Explain and demonstrate the functionality of timer devices in an embedded system[
    9·1 answer
  • David would like to send a letter to more than one hundred people. He would like the letter to have names and addresses inserted
    12·2 answers
  • Looking for friends, anyone up for it?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!