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
AleksAgata [21]
4 years ago
15

Write a function called check_nums that takes a list as its parameter, and contains a while loop that only stops once the elemen

t of the list is the number 7. What is returned is a list of all of the numbers up until it reaches 7.
Computers and Technology
1 answer:
MissTica4 years ago
4 0

Answer:

Following are the program in the Python Programming Language:

def check_nums(length): #define function

 my_lst=[]  #set list type variable

 n=0  #set integer type variable

 while(length[n] != 7): #set the while loop  

   my_lst.append(length[n])  #append liat in my_lst

   n+=1  #increament in n

   if(len(length)==n): #set if condition

     break  #break the loop

 return my_lst  #return the list

l=[4,6,2,55,16,7,81]  #set list variable and assign list init

print(check_nums(l)) #call and print the function

<u>Output</u>:

[4, 6, 2, 55, 16]

Explanation:

Here, we define a function "check_nums()" and pass an argument in its parentheses inside the function,

  • we set list data type variable "my_lst" and integer type variable "n"
  • we set while loop and pass the condition is the variable "length[n]" is not equal to the 7 then, the value of "length[n] " is appends to the variable "my_lst" and increment in the variable "n" by 1.
  • we set if condition and check when the length of the variable "length" is equal to the variable "n" then, break the loop and return the value of "my_lst".

Finally, set the list type variable "l" and assign the list of numeric value in it then, call and print the function "check_nums"

You might be interested in
What variable type is the output of a logical operator in labview?
Stella [2.4K]

Answer:

Boolean data types

Explanation:

consist of only two values i.e. true and false. It is a logical data type providing the output in the form of 0 or 1 specifying false and true respectively. The Boolean data type is indicated by green data wires. LabView stores the Boolean data as 8-bit values.

5 0
3 years ago
An IT systems engineer creates a new Domain Name System (DNS) zone that contains a pointer (PTR) resource records. Which zone ty
irina1246 [14]

Answer: Reverse DNS zone

Explo: a reverse DNS zone needs a PTR record since it is in charge of resolving the IP address to a domain or a hostname.

5 0
3 years ago
Ann wants to save her presentation so she can work on it later. Which device on her computer can store this data long term?
igomit [66]
She can use a flashdrive to store it, or she can go to her documents folder and store it. When she gets on the computer later, she can then continue working on the project.
3 0
3 years ago
Points on how will successfully submit quizzes in ICT correctly?
jeka94

Answer:

I am sorry but I don't understand your question. Can you edit it and explain it more briefly?

Explanation:

6 0
4 years ago
My programming lab 9.2 C++ Write a full class definition for a class named Counter, and containing the following members:_______
cupoosta [38]

Answer:

class Counter {    

 public:

   int counter;

   Counter(int counter) {     // Constructor

     counter = counter;

   }

   void increment(){

      counter++;

  }

 

   void decrement(){

      counter--;

   }

    int getValue(){

       return counter;

   }

};

<h2><u>Explanation:</u></h2>

// Class header definition for Counter class

class Counter {    

// Write access modifiers for the properties(data members) and methods

 public:

  //a. Create data member counter of type int

   int counter;

   //b. Create a constructor that takes one int argument and assigns

   // its value to counter.

   Counter(int counter) {     // Constructor  with argument counter

    counter = counter;         // Assign the argument counter to the data

                                              // member counter

   }

   // c. Create a function increment that accepts no parameters

   // and returns no value (i.e void)

   void increment(){

      counter++;   // d. increment adds one to the counter data member

  }

 

   // e. Create a function decrement that accepts no parameters

   // and returns no value (i.e void)

   void decrement(){

      counter--;   // f. decrement subtracts one from the counter data member

   }

   // g. Create a function called getValue that accepts no parameters.

   // The return type is int, since the data member to be returned is of

   // type int.

    int getValue(){

       return counter; // h. it returns the value of the instance var counter

   }

}; // End of class declaration

Hope this helps!

8 0
4 years ago
Other questions:
  • A ____ network (or workgroup) consists of multiple windows computers that share information, but no computer on the network serv
    15·1 answer
  • The Internet shopping cart is an example of which version of the web?
    15·1 answer
  • How can i become an ailen?
    5·2 answers
  • How do you get a code in C to count down from 5??
    6·1 answer
  • An article explaining the uses of the parts of a computer​
    14·1 answer
  • What is malware? a type of virus that spreads through a network connection a type of virus that targets programs and files any p
    8·1 answer
  • Help brainliest True or False
    10·2 answers
  • Which important aspect of the Roman Empire did the barbarians destroy?
    14·2 answers
  • Write A Code In Python
    8·2 answers
  • A data analyst creates a data frame with data that has more than 50,000 observations in it. When they print their data frame, it
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!