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]
2 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]2 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
Which technology concept uses computer resources from multiple locations to solve a common problem?​
umka2103 [35]

Answer:

Distributed memory systems

Distributed memory systems use multiple computers to solve a common problem, with computation distributed among the connected computers (nodes) and using message-passing to communicate between the nodes.

Explanation:

5 0
3 years ago
The formatting option functions like space bar. However instead of moving one space at a time, it allows you to move your text i
Schach [20]
What are the options???
4 0
3 years ago
g Points The critical section cannot be executed by more than one process at a time. false true Save Answer Q3.28 Points The cod
Ira Lisetskai [31]

Answer: Hello your question lacks some details attached below is the missing detail

answer :

a) True , B) False  C) True  D) True

Explanation:

a) True ; The critical section cannot be executed by more than one process at a time

b) False : The code does not satisfy the progress condition, because while loops are same hence no progress

c ) True :  The code satisfies the bounded waiting condition, because of the waiting condition of the while loop

d) True : No matter how many times this program is run, it will always produce the same output, this is because of the while loop condition

7 0
3 years ago
As text is typed in the _____ text box, a drop-down list displays options for completing the action, displaying information on t
pickupchik [31]

Answer:

Excel Help

Explanation:

Press F1 key to open the excel help window

Or you can also click the excel help button to launch the help window.

Type for whatever you are seeking help for and you will notice suggestions as you type something. These suggestions include online and offline results. If there are too many results then try searching offline it will narrow down the results.

After typing the text and hitting enter, the excel help returns several related topics on the searched query. You can browse through these topics and get help from excel.

5 0
3 years ago
Poshmark is more than a shopping app; it connects people and brings them together. Poshmark is a passionate group of people that
babymother [125]

Poshmark is more than a shopping app. It is known to be a shopping applicationthat links a person to other people whose style one likes.

<h3>What is the aim of Poshmark?</h3>

Poshmark is known to be a shopping app that links a person to other people whose style one likes adore.

It is known to help one to easily shop for any of their closets and boutiques needs. They are known to have about 80 million community members in all of the U.S., Canada, and Australia.

learn more about Poshmark from

brainly.com/question/26258231

8 0
2 years ago
Other questions:
  • Being tired has very similar effects on the body as what
    7·1 answer
  • Which RFC reserves three ranges of IP addresses for private use - a single Class A (10.0.0.0-10.255.255.255), 16 Class Bs (172.1
    15·1 answer
  • Which option best describes the cheapest way to file your federal income taxes?
    5·1 answer
  • How can an Excel table be added to a Word document? Check all that apply.
    15·1 answer
  • . How is using 0 / 1 or true / false in specifying digital an abstraction?
    11·1 answer
  • The purpose of this assignment is to determine a set of test cases knowing only the function’s specifications, reported hereaf
    12·1 answer
  • When you expect a reader of your message to be uninterested, unwilling, displeased, or hostile, you should Group of answer choic
    15·1 answer
  • The marketing company era marks the time when companies realized they needed to switch from just trying to sell
    8·1 answer
  • Who invented the first mechanical computer? in what year was it invented?.
    11·1 answer
  • Hi can someone please help me with this homework please?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!