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
Andre45 [30]
3 years ago
5

Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15

3 the output is: 3
Computers and Technology
1 answer:
coldgirl [10]3 years ago
7 0

Answer:

The  program in Python is as follows:

nums = []

for i in range(3):

   num = int(input(""))

   nums.append(num)

   

print(min(nums))

Explanation:

This initializes a list of numbers

nums = []

This loop is repeated 3 times

for i in range(3):

For each repetition, this prompts the user for input

   num = int(input(""))

This appends the input to the list

   nums.append(num)

This gets the smallest of the three inputs using the min() function. The smallest is also printed

print(min(nums))

You might be interested in
Design and implement a class Country that stores the name of the country, its population, its area, and the population density (
melomori [17]

Answer:

See explaination

Explanation:

Make use of Python programming language.

File: Country.py

class Country:

def __init__(self, n="", p=0, a=0):

""" Constructor """

self.name = n

self.population = p

self.area = a

self.pDensity = self.population / self.area

def getCountryName(self):

""" Getter method """

return self.name

def getPopulation(self):

""" Getter Method """

return self.population

def getArea(self):

""" Getter Method """

return self.area

def getPDensity(self):

""" Getter Method """

return self.pDensity

File: CountryInfo.py

from Country import *

# Opening file for reading

with open("d:\\Python\\data.txt", "r") as fp:

# List that hold countries

countryInfo = []

# Processing file line by line

for line in fp:

# Stripping spaces and new lines

line = line.strip()

# Splitting and creating object

cols = line.split('\t')

cols[1] = cols[1].replace(',', '')

cols[2] = cols[2].replace(',', '')

c = Country(cols[0], int(cols[1]), float(cols[2]))

countryInfo.append(c)

# Processing each countryInfo

largestPop = 0

largestArea = 0

largestPDensity = 0

# Iterating over list

for i in range(len(countryInfo)):

# Checking population

if countryInfo[i].getPopulation() > countryInfo[largestPop].getPopulation():

largestPop = i;

# Checking area

if countryInfo[i].getArea() > countryInfo[largestPop].getArea():

largestArea = i;

# Checking population density

if countryInfo[i].getPDensity() > countryInfo[largestPop].getPDensity():

largestPDensity = i;

print("\nLargest population: " + countryInfo[largestPop].getCountryName())

print("\nLargest area: " + countryInfo[largestArea].getCountryName())

print("\nLargest population density: " + countryInfo[largestPDensity].getCountryName() + "\n")

Please go to attachment for sample program run

4 0
3 years ago
Having a good credit score is important because:
Lisa [10]
It would be better if we could see the options, fully. But from what I can see, it should be B.
7 0
3 years ago
What is the best way to improve the following code fragment? if ((counter % 10) == 0) { System.out.println("Counter is divisible
meriva

Answer:

Move the duplicated code outside of the if statement

5 0
3 years ago
Assume that name has been declared suitably for storing names (like "amy" , "fritz" and "moustafa") write some code that reads a
tamaranim1 [39]
Name = "Bob"
# or you can prompt the user to enter their name:
# name = input("What's your name? ")

print("greetings," , name)
3 0
3 years ago
__ is/are the amount of blank space between lines of text in a paragraph
Natali [406]
Indents? Double Space? one of those
5 0
3 years ago
Read 2 more answers
Other questions:
  • You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will
    12·1 answer
  • When the minnesota timberwolves encouraged facebook fans to post a great shot of a dunk onto its pinterest page for a chance to
    6·1 answer
  • If you implement a Wireless LAN (WLAN) to support connectivity for laptops in the Workstation Domain, which domain does WLAN fal
    5·1 answer
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    6·2 answers
  • Which job role requires you to create user guides for computer products and services?
    11·1 answer
  • Login
    11·1 answer
  • How ssd is better than normal sata and pata HDD​
    11·1 answer
  • What happens if an email server cannot find a matching username or the mailbox is full
    14·2 answers
  • Who is famous for his three laws of robotics?
    9·1 answer
  • missy just hired a software development team to create an educational simulation app for a high school course. she has specific
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!