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
nydimaria [60]
4 years ago
12

7.6 LAB: Checker for integer string Forms often allow a user to enter an integer. Write a program that takes in a string represe

nting an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: yes Ex: If the input is: 42,000 or any string with a non-integer character, the output is: no
Computers and Technology
1 answer:
Evgen [1.6K]4 years ago
7 0

Answer:

Following are the program in the Python Programming Language:

def check(num): #define function

 if(num.isdigit()): #set if statement

   return "yes"; #return yes if condition is true

 else:  

   return "no";# return no if condition is false

string=input("Enter the numbers 0-9: ") #get input from the user

print(check(string)) #print and call the function

Output:

Enter the numbers 0-9: 1995

yes

Enter the numbers 0-9: 42,000

no

Explanation:

Here, we define a function "check()" and pass an argument in its parameter "num" inside the function.

  • we set if-else conditional statement and check the value stored in the variable "num" is the digit by using built in function "isdigit()" then return "yes".
  • Then, otherwise it return "no".

Finally, we get the input from the user in the variable "string" then, we call the function through "print()" function.

You might be interested in
The person who suggested that the continents were once a supercontinent, called Pangaea, but slowly drifted apart was who
kherson [118]
Alfred Wegener was the one who came up with the Pangea.
3 0
3 years ago
Read 2 more answers
Chegg A full bootstrap program Select one: a. may be infected by viruses. b. is stored in ROM to ensure to avoid any infection f
harina [27]

Answer:

Option b = "is stored in ROM to ensure to avoid any infection from viruses. "

Explanation:

In order to to understand the fundamentals of an Operating system in computer one needs to know what the bootstrap program is.

The BOOTSTRAP PROGRAM is first program that will run when the computer is switched on, thus the program( the BOOTSTRAP PROGRAM) will be the program to open the OPERATING SYSTEM.

The device in laptops and personal computers known as ROM is an acronym that stands for Read-Only Memory and it is a storage medium. Because of ROM inability to get Virus it is used in the storage of Bootstrap program.

8 0
3 years ago
Whats the flow in this code, and whats the risk that its creating and what can i do to fix it? (c language)
Advocard [28]

Answer:

The risk is a buffer overflow.

Explanation:

Whatever the user passes as a command line argument, will be copied into the buffer. If the user passes more than 499 characters, the end of the buffer will be overwritten.

To solve it, compare the string length of argv[1] to 500 before copying, or even better, start using the new strcpy_s( ) function.

6 0
3 years ago
Write a Java program in jGRASP that creates a 2D integer array of 5 rows and 20 columns, fills it with increasing integer values
Alex73 [517]

Answer:

As per the question we need to make 5 rowa and 2o columns, in this we have total element 100 so range should be 0 to 99, but we are suggested to keep range 0 to 59, so i have kept the elementns in the range, but if it was a typo in the question for range you do not need to reset the k with zero.

Explanation:

//create a new class  TestArray

public class TestArray {

//define main method

public static void main(String[] args) {

 //declare a 2D array of given size i.e. 5 rows and 20 columns

 int arr[][] = new int[5][20];

 //declare an integer variable k and initialize it with zero, this will used to initialize the array from 0 to 99

 int k = 0;

 //for loop for rows

 for (int i = 0; i < 5; i++) {

  //for loop for columns

  for (int j = 0; j < 20; j++) {

   //initialize arr with the current value of k

   arr[i][j] = k;

   //once k is 59 set it zero again as we are not going beyond 59

   if(k == 59)

    k = 0;

   //increment value of k with 1

   k++;

  }

 }

 //print the element from the array one by one

 //for loop for rows

 for (int i = 0; i < 5; i++) {

  //for loop for columns

  for (int j = 0; j < 20; j++) {

   //print the current element of array and an space with it

   System.out.print(arr[i][j]+" ");

  }

  // move the cursor to new line

  System.out.println();

 }

}

}

7 0
4 years ago
01000100 01101111 00100000 01111001 01101111 01110101 00100000 01101011 01101110 01101111 01110111 00100000 01111001 01101111 01
Anna71 [15]
This was quite tricky but, I found a program online that answers your question. The answer is (Do you know your binary code? Answer this in binary code)
5 0
4 years ago
Read 2 more answers
Other questions:
  • Earthquakes happen in the Earth’s
    10·1 answer
  • Which devices are managed through device management?
    5·1 answer
  • What is the name for the percentage of people who don't have jobs in a country or area?
    11·2 answers
  • 14. What is the simplest way to permanently get rid of an unwanted file?
    9·1 answer
  • What type of cable is used to connect a workstation serial port to a cisco router console port?
    15·1 answer
  • Respond to the following in three to five sentences. Select the workplace skill, habit, or attitude described in this chapter th
    15·2 answers
  • This program will output a right triangle based on user specified height triangleHeight and symbol triangleChar. (1) The given p
    14·1 answer
  • Explain how you would insert graphics using your word-processing software.
    14·1 answer
  • In this problem, you will fill in the code for a function count_digits(val) that takes a positive integer, val, and returns a li
    12·1 answer
  • many police departments coordinate youth-oriented programs as part of their prevention efforts. which of the following is not an
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!