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
An output device is any device that displays, prints, or plays content stored on a computer. from the list below, identify the d
inysia [295]
Answer is C = Speaker

How? as the speaker is the only item on the list that displays any type of content, that being audio, it's the only feasible answer to this question.
3 0
3 years ago
Description:
Nastasia [14]

Answer:

The programming language is not stated (I'll answer using C++)

#include <iostream>

using namespace std;

int convert(float miles)

{

   return miles * 5280;

}

int main() {

   cout<<"Console:"<<endl;

   cout<<"Hike Calculator"<<endl;

   float miles;

   char response;

   cout<<"How many miles did you walk?. ";

   cin>>miles;

   cout<<"You walked "<<convert(miles)<<" feet"<<endl;

   cout<<"Continue? (y/n): ";

   cin>>response;

   while(response == 'y')

   {

   cout<<"How many miles did you walk?. ";

   cin>>miles;

   cout<<"You walked "<<convert(miles)<<" feet"<<endl;

   cout<<"Continue? (y/n): ";

   cin>>response;

   }

   cout<<"Bye!";

   return 0;

}

Explanation:

Here, I'll explain some difficult lines (one after the other)

The italicized represents the function that returns the number of feet

<em>int convert(float miles) </em>

<em>{ </em>

<em>    return miles * 5280; </em>

<em>} </em>

The main method starts here

int main() {

The next two lines gives an info about the program

   cout<<"Console:"<<endl;

   cout<<"Hike Calculator"<<endl;

   float miles;

   char response;

This line prompts user for number of miles

   cout<<"How many miles did you walk?. ";

   cin>>miles;

This line calls the function that converts miles to feet and prints the feet equivalent of miles

   cout<<"You walked "<<convert(miles)<<" feet"<<endl;

This line prompts user for another conversion

   cout<<"Continue? (y/n): ";

   cin>>response;

This is an iteration that repeats its execution as long as user continue input y as response

<em>    while(response == 'y') </em>

<em>    { </em>

<em>    cout<<"How many miles did you walk?. "; </em>

<em>    cin>>miles; </em>

<em>    cout<<"You walked "<<convert(miles)<<" feet"<<endl; </em>

<em>    cout<<"Continue? (y/n): "; </em>

<em>    cin>>response; </em>

<em>    } </em>

   cout<<"Bye!";

8 0
3 years ago
What are the 49 questions for creat and edit Excel assessment​
castortr0y [4]

Answer:

1. What is the keyboard shortcut key to lock cell references in a formula

2. What are the shortcut keys for Auto Sum?

3. What are the shortcut keys to insert a new row in an Excel spreadsheet?

4. What are the shortcut keys to group rows so you can expand/contract a section of data?

5. Which of the following Excel features allows you to select/highlight all cells that are formulas?

6. What are the keyboard shortcut keys to paste special?

7. Assuming cell A1 is displaying the number "12000.7789". What formula should be used to round this number to the closest integer?

8. What are the keyboard shortcut keys to edit formula in a cell?

9. What are the keyboard shortcut keys to insert a table?

10. In which tab of the ribbon can you change Workbook Views to Page Break Preview?

11. What is the best practice for financial modeling in excel?

12. Which of the following features cannot be found in the Data ribbon?

13. The shortcut keys to increase the number of decimal places are

14. What are the shortcut keys to open up the Find and Replace window?

15. Which tab of the ribbon should you go to for removing grid lines on a worksheet?

16. What is a cell address in Excel?

17. What do you mean by Relative cell referencing and Absolute cell referencing in MS Excel?

18. How can you restrict someone from copying a cell from your worksheet?

19. How is a Formula different from a Function in Excel?

20. Mention the order of operations used in Excel while evaluating formulas.

21. What is the difference between count, counta, and countblank?

22. What is the shortcut to add a filter to a table?

23. How can we merge multiple cells text strings in a cell?

24. How many report formats are available in Excel?

25. What is a Pivot Table?

26. How do you find duplicate values in a column?

27. How can you remove duplicate values in a range of cells?

28. What are the wildcards available in Excel?

29. What is Data Validation? Illustrate with an example.

30. How do you create a column in a pivot table?

31. How does a Slicer work in Excel?

32. What are macros in Excel?

33. What is the What-If Analysis in Excel?

34. What is the difference between a function and a subroutine in VBA?

35. What is the difference between This Workbook and Active Workbook in VBA?

36. How do we check whether a file exists or not in a specified location?

37. Write a VBA function to calculate the area of a rectangle.

38. Write a VBA function to check if a number is a prime number or not.

Explanation:

I think these questions are enough for you.

4 0
2 years ago
I need help with this plz! It’s for a test and I really need help
Bas_tet [7]

Answer:

c

Explanation:

assuming you are coding in python and have not install any calculation codes, the answer is most likely c

4 0
3 years ago
Insurance can help you:a. minimize monthly expenses
KIM [24]
This is an easy answer sure in the back of your mind u knew it was b good luck :).

4 0
3 years ago
Other questions:
  • The benefits associated with AAA are increased security, increased control over the network, and the capability of auditing your
    12·1 answer
  • Which of these options would likely have a better playback experience in your presentation?
    8·2 answers
  • How to tell if motherboard has bluetooth?
    8·1 answer
  • A(n) monitoring vulnerability scanner is one that listens in on the network and determines vulnerable versions of both server an
    7·1 answer
  • Can Word Processing (WP) programs be used for DTP? Explain your answer
    7·1 answer
  • Spoken word and written word are different because what
    9·1 answer
  • Downloading files is safe for most types of files except Select one: a. documents. b. pictures. c. executable files. d. music fi
    7·1 answer
  • The function below takes a single argument: data_list, a list containing a mix of strings and numbers. The function tries to use
    6·1 answer
  • How to write email abut new home your friend ​
    14·1 answer
  • NEED ANSWER ASAP. CORRECT ANSWER GETS BRAINLIEST! TY
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!