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
trapecia [35]
3 years ago
10

#Write a function called get_integer that takes as input one #variable, my_var. If my_var can be converted to an integer, #do so

and return that integer. If my_var cannot be converted #to an integer, return a message that says, "Cannot convert!" # #For example, for "5" as the value of my_var, get_integer would #return the integer 5. If the value of my_var is the string #"Boggle.", then get_integer would return a string with the #value "Cannot convert!" # #Do not use any conditionals or the type() function.
Computers and Technology
1 answer:
DiKsa [7]3 years ago
6 0

Answer:

#here is function in python

#function that return integer if input can be converted to int

#if not it will return a string "Cannot converted!!"

def get_integer(inp):

   try:

       return int(inp)

   except:

       return "Cannot convert!!"

print()

#call the function with different inputs

print(get_integer("5"))

print(get_integer("Boggle."))

print(get_integer(5.1))

print()

Explanation:

Define a function get_integer() with a parameter.In this function there is try  and except.First try will execute and if input can be converted to integer then  it will convert it into integer and return it.If it will not able to convert  the input into integer then except will return a string "Cannot convert!!".In the function get_integer(), there is no use of any conditionals or type function.

Output:

5

Cannot convert!!

5  

You might be interested in
Write a function called min that returns the minimum of the two numbers passed in as parameters.
Kitty [74]

def min(x,y):

   smallest = x

   if y < smallest:

       smallest = y

   return smallest

x = min(2,1)

print("The min is "+str(x))

Although I wouldn't recommend using the name min for a function because min is the name of an existing function. Best of luck.

4 0
3 years ago
Consider the three major Vs as Volume, Velocity and Variety along with other Big Data contexts. Match the terms with the short s
12345 [234]

Answer:

See explaination

Explanation:

(MapReduce) = Programming Model

(Variability) = Sentiment analysis

(Feedback Loop Processing) = Health Systems transit

(volume, velocity, variety) = Big Data, applied to collect data

(Hadoop) = A Big Data Application that handles very large-sized block of data.

5 0
3 years ago
Write code that prints: Ready! firstNumber ... 2 1 Run!
motikmotik

Answer:

The program to this question can be defined as follows:

Program:

num=int(input("Enter any number: ")) #defining variable num, that take value from user

val=0; #defining variable val

for i in range(num): #defining loop to calculate value in decreasing order

   val=num-i; #holding value in variable

   print(val) #print value

Output:

Enter any number: 3

3

2

1

Explanation:

In the above-given code, a variable "num" is declared, that uses input function to take value from the user end, in the next line a "val" variable is defined, that calculates values and print it in decreasing order.

  • In the next step, a for loop is declared, inside the loop a "val" variable uses num and loop variable "i" to calculate the value in decreasing order.
  • In the last print method is used that prints "val" variable value.
3 0
3 years ago
CONVERT .0001 KILOMETERS TO MILLIMETERS
Trava [24]

Answer:

The answer to this question is given below in the explanation section

Explanation:

As we know that

1 km = 1000000 mm

So, 0.001 * 1000000 =  100

the answer is 100 millimeters.

7 0
3 years ago
Which IDS component is essentially the same as a sniffer in that it runs in conjunction with a network card in promiscuous mode?
Snowcat [4.5K]

Answer:

D. Network tap

Explanation:

A network tap is a hardware device that provides a way to access the data flow across a computer network.

A sniffer is either hardware or software that provides a way to access the data flow across a computer network.

Hence, these two IDS components are very similar.

Cheers.

7 0
3 years ago
Other questions:
  • Why would an over the shoulder shot be used
    11·1 answer
  • Producers must understand the marginal benefit of making an additional unit which shows the ...
    5·2 answers
  • PLEASE DON'T DELETE THIS QUESTION!!!!
    15·2 answers
  • If there is a mistake with one of your bank accounts, who should you contact to resolve the issue
    14·1 answer
  • Consider a movie database in which data is recorded about the movie industry. the data requirements are summarized as follows:
    15·1 answer
  • The _____ is a blinking vertical line that indicates where the next typed character will appear. scroll box sheet tab insertion
    7·1 answer
  • What is the Intranet?<br>​
    5·1 answer
  • Que es la felicidad??​
    12·1 answer
  • Question 3 (2 points)
    6·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!