The function below takes one parameter: an integer (begin). Complete the function so that it prints every other number starting at begin down to and including 0, each on a separate line. There are two recommended approaches for this: (1) use a for loop over a range statement with a negative step value, or (2) use a while loop, printing and decrementing the value each time.

1 - def countdown_trigger (begin):
2 i = begin
3 while i < 0:
4 print(i)
5 i -= 1 Restore original file

Answers

Answer 1

Answer:

Follows are code to the given question:

def countdown_trigger(begin):#defining a method countdown_trigger that accepts a parameter

   i = begin#defining variable that holds parameter value

   while i >= 0:#defining while loop that check i value greater than equal to0

       print(i)#print i value

       i -= 2  # decreasing i value by 2  

print(countdown_trigger(2))#calling method

Output:

2

0

None

Explanation:

In this code, a method "countdown_trigger" is declared, that accepts "begin" variable value in its parameters, and inside the method "i" declared, that holds parameters values.

By using a while loop, that checks "i" value which is greater than equal to 0, and prints "value" by decreasing a value by 2.


Related Questions

What are some examples and non-examples of digital security?

Answers

Answer:

Devices such as a smart card-based USB token, the SIM card in your cell phone, the secure chip in your contactless payment card or an ePassport are digital security devices

Which of the following are complete sets of data and are the rows of the table?
Files
Fields
Queries
Records

Answers

Answer:

I think the answer is going to be records

your computer has been running slowly and you suspect it because its is low on memory. you review the hardware configuration and find that computer has only 4gb of ram. how can you determine how much memory your computer should have to run properly?​

Answers

By downloading software that is capable of checking live Ram usage/need. GIVE BRAINLIST

Note that common skills are listed toward the top, and less common skills are listed toward the bottom. According to O*NET, what are common skills needed by Secondary School Special Education Teachers? Check all that apply.

instructing
installation
learning strategies
repairing
active listening
technology design

Answers

Answer:

A. Instucting   C. Learning Strategies   E. Active Listening

Explanation:

Got it right on assignment

Parts of a computer software

Answers

Answer:

I think application software

utility software

networking software

You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you realize that some boxcars are overloaded and weigh too heavily on the rails while others are dangerously light. So you decide to stop the train and spread the weight more evenly so that all the boxcars have exactly the same weight (without changing the total weight). For that you write a program which helps you in the distribution of the weight.
Your program should first read the number of cars to be weighed (integer) followed by the weights of the cars (doubles). Then your program should calculate and display how much weight to add or subtract from each car such that every car has the same weight. The total weight of all of the cars should not change. These additions and subtractions of weights should be displayed with one decimal place. You may assume that there are no more than 50 boxcars.
Example 1
In this example, there are 5 boxcars with different weights summing to 110.0. The ouput shows that we are modifying all the boxcars so that they each carry a weight of 22.0 (which makes a total of 110.0 for the entire train). So we remove 18.0 for the first boxcar, we add 10.0 for the second, we add 2.0 for the third, etc.
Input
5
40.0
12.0
20.0
5. 33.
0
Output
- 18.0
10.0
2.0
17.0
-11.0

Answers

Answer:

The program in C++ is as follows:

#include <iostream>

#include <iomanip>

using namespace std;

int main(){

   int cars;

   cin>>cars;

   double weights[cars];

   double total = 0;

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

       cin>>weights[i];

       total+=weights[i];    }

   double avg = total/cars;

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

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

   return 0;

}

Explanation:

This declares the number of cars as integers

   int cars;

This gets input for the number of cars

   cin>>cars;

This declares the weight of the cars as an array of double datatype

   double weights[cars];

This initializes the total weights to 0

   double total = 0;

This iterates through the number of cars

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

This gets input for each weight

       cin>>weights[i];

This adds up the total weight

       total+=weights[i];    }

This calculates the average weights

   double avg = total/cars;

This iterates through the number of cars

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

This prints how much weight to be added or subtracted

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

Write an application that combines several classes and interfaces.

Answers

Answer:

Explanation:

The following program is written in Java and it combines several classes and an interface in order to save different pet objects and their needed methods and specifications.

import java.util.Scanner;

interface Animal {

   void animalSound(String sound);

   void sleep(int time);

}

public class PetInformation {

   public static void main(String[] args) {

       Scanner scnr = new Scanner(System.in);

       String petName, dogName;

       String dogBreed = "null";

       int petAge, dogAge;

       Pet myPet = new Pet();

       System.out.println("Enter Pet Name:");

       petName = scnr.nextLine();

       System.out.println("Enter Pet Age:");

       petAge = scnr.nextInt();

       Dog myDog = new Dog();

       System.out.println("Enter Dog Name:");

       dogName = scnr.next();

       System.out.println("Enter Dog Age:");

       dogAge = scnr.nextInt();

       scnr.nextLine();

       System.out.println("Enter Dog Breed:");

       dogBreed = scnr.nextLine();

       System.out.println(" ");

       myPet.setName(petName);

       myPet.setAge(petAge);

       myPet.printInfo();

       myDog.setName(dogName);

       myDog.setAge(dogAge);

       myDog.setBreed(dogBreed);

       myDog.printInfo();

       System.out.println(" Breed: " + myDog.getBreed());

   }

}

class Pet implements Animal{

   protected String petName;

   protected int petAge;

   public void setName(String userName) {

       petName = userName;

   }

   public String getName() {

       return petName;

   }

   public void setAge(int userAge) {

       petAge = userAge;

   }

   public int getAge() {

       return petAge;

   }

   public void printInfo() {

       System.out.println("Pet Information: ");

       System.out.println(" Name: " + petName);

       System.out.println(" Age: " + petAge);

   }

   //The at (email symbol) goes before the Override keyword, Brainly detects it as a swearword and wont allow it

   Override

   public void animalSound(String sound) {

       System.out.println(this.petName + " says: " + sound);

   }

//The at (email symbol) goes before the Override keyword, Brainly detects it as a swearword and wont allow it

  Override

   public void sleep(int time) {

       System.out.println(this.petName + " sleeps for " + time + "minutes");

   }

}

class Dog extends Pet {

   private String dogBreed;

   public void setBreed(String userBreed) {

       dogBreed = userBreed;

   }

   public String getBreed() {

       return dogBreed;

   }

}

If you want to continue working on your web page the next day, what should you do?

a. Create a copy of the file and make changes in that new copy

b. Start over from scratch with a new file

c. Once a file has been saved, you cannot change it

d. Reopen the file in your text editor to

Answers

Answer:

d. Reopen the file in your text editor

Answer:

eeeeeeeee

Explanation:

You will write code to manipulate strings using pointers but without using the string handling functions in string.h. Do not include string.h in your code. You will not get any points unless you use pointers throughout both parts.
You will read in two strings from a file cp4in_1.txt at a time (there will be 2n strings, and you will read them until EOF) and then do the following. You alternately take characters from the two strings and string them together and create a new string which you will store in a new string variable. You may assume that each string is no more than 20 characters long (not including the null terminator), but can be far less. You must use pointers. You may store each string in an array, but are not allowed to treat the string as a character array in the sense that you may not have statements like c[i] = a[i], but rather *c *a is allowed. You will not get any points unless you use pointers.
Example:
Input file output file
ABCDE APBQCRDSETFG
PQRSTFG arrow abcdefghijklmnopgrstuvwxyz
acegikmoqsuwyz
bdfhjlnprtvx

Answers

Solution :

#include [tex]$< \text{stdio.h} >$[/tex]

#include [tex]$< \text{stdlib.h} >$[/tex]

int [tex]$\text{main}()$[/tex]

{

[tex]$\text{FILE}$[/tex] *fp;

[tex]$\text{fp}$[/tex]=fopen("cp4in_1.txt","r");

char ch;

//while(1)

//{

while(!feof(fp))

{

char *[tex]$\text{s1}$[/tex],*[tex]$\text{s2}$[/tex],*[tex]$\text{s3}$[/tex];

[tex]$\text{s1}$[/tex] = (char*) [tex]$\text{malloc}$[/tex]([tex]$20$[/tex] * [tex]$\text{sizeof}$[/tex](char));

[tex]$\text{s2}$[/tex] = (char*) [tex]$\text{malloc}$[/tex]([tex]$20$[/tex] * [tex]$\text{sizeof}$[/tex](char));

[tex]$\text{s3}$[/tex] = (char*) [tex]$\text{malloc}$[/tex]([tex]$40$[/tex] * [tex]$\text{sizeof}$[/tex](char));

[tex]$\text{int i}$[/tex]=0,j=0,x,y;

while(1)

{

ch=getc(fp);

if(ch=='\n')

break;

*(s1+i)=ch;

i++;

}

while(1)

{

ch=getc(fp);

if(ch=='\n')

break;

*(s2+j)=ch;

j++;

}

for(x=0;x<i;x++)

{

*(s3+x)=*(s1+x);

}

for(y=0;y<j;x++,y++)

{

*(s3+x)=*(s2+y);

}

for(x=0;x<i+j;x++)

{

printf("%c",*(s3+x));

}

printf("\n");

getc(fp);

}

}

4 reasons why users attach speakers
to their computers​

Answers

Answer: we connected speakers with computers for listening voices or sound because the computer has not their own speaker. the purpose of speakers is to produce audio output that can be heard by the listener. Speakers are transducers that convert electromagnetic waves into sound waves. The speakers receive audio input from a device such as a computer or an audio receiver.

Explanation: Hope this helps!

Write a Python class that inputs a polynomial in standard algebraic notation and outputs the first derivative of that polynomial. Both the inputted polynomial and its derivative should be represented as strings.

Answers

Answer:Python code: This will work for equations that have "+" symbol .If you want to change the code to work for "-" also then change the code accordingly. import re def readEquation(eq): terms = eq.s

Explanation:

I want to know the basic of Excel

Answers

Answer:

Use Pivot Tables to recognize and make sense of data.

Add more than one row or column.

Use filters to simplify your data.

Remove duplicate data points or sets.

Transpose rows into columns.

Split up text information between columns.

Use these formulas for simple calculations.

Get the average of numbers in your cells.

HURRY- I’ll give 15 points and brainliest answer!!
How do you insert text into a presentation??
By selecting text from the insert menu
By clicking in the task pane and entering text
By clicking in a placeholder and entering text
By drawing a text box clicking in it and entering text
(This answer is multiple select)

Answers

Answer:

the last one the drawing thingy:)))

Other Questions
cookies cost $2.50, where y represents the total cost of x, number of cookiesa. additiveb. Multiplicative What were the effects of War Communism on Russia? Use a semicolon to join two independent clauses with a transition word or phrase, such as for example. A comma must follow the transition phrase. PLS ANWSWER QUICK IM SO BEHIND!!!Leon says his head feels like somone is tightening a belt around it what is leon experiencing? A heart attackA migraineA strokeA tension headache A butcher shop is selling steaks 2 for $7.00. The butcher sells 29 steaks today. How much money did the butcher make selling steaks today? Please Help! ~ Math ~ You will get +10 points! ~ Multiple Chouce ~ 1 Problem!In a basketball game, Sarah scored 4 points more than twice the number of points Jamie scored. Jamie scored 3 ponts. How many points did Sarah score? A. 1 PointB. 7 PointsC. 10 PointsD. 12 Points- FIND THE AREA OF THE SHADED SECTION IN THE CIRCLE THE SHADED SECTION IS 35 DEGRESS AND THE RADIUS IS 5 INCHES. USE THE FORMULA: M/360 TIMES PIE R SQUARED Because of the relatively high interest rates, most consumers attempt to pay off their credit card bills promptly. However, this is not always possible. An analysis of the amount of interest paid monthly by a bank's Visa cardholders reveals that the amount is normally distributed with a mean of 27 dollars and a standard deviation of 8 dollars.A. What proportion of the bank's Visa cardholders pay more than 32 dollars in interest?B. What proportion of the bank's Visa cardholders pay more than 40 dollars in interest?C. What proportion of the bank's Visa cardholders pay less than 19 dollars in interest?D. What interest payment is exceeded by only 19% of the bank's Visa cardholders? Write 3-5 sentence summary of the events that occurred at the Tiananmen Square. You can write it from the point of view of a protester or a government official. Make sure you let me know which one you choose. the u.s. produces 5.39x 10 Micayla wants the print shop to reduce the size of her painting but keep the ratio of length to width so that it will fit her frame. Study the scale drawings to determine the proportional relationship between her painting and the frame she wants to use. Which of these describes the transformation of XYZ to XYZ? Could you please answer? I'm on a big test PLEASE ANSWERWhat is one reason why housing, like the one pictured abovein the 1970s, expanded?A. the government forcibly relocated indigenous populations from rural areasB. Migrants from rural areas could not afford to settle in city centersC. the government was not able to provide utilities to urban areas D. regional conflicts resulted in the establishment of large refugee camps b) A piece of solid gold was heated from 274K to 314K using 55.7J of energy to raise thetemperature. What mass of gold was present? How many grams of Ca metal are produced by the electrolysis of molten CaBr2 using a current of 30.0 amp for5.50 hours? HELLP I need this question The scale that measures the strength of an earthquake based on the size of the seismic waves recorded by a seismograph is called the_________scale. NEED ANSWER ASAP WILL GIVE BRAINLIEST FOR CORRECT ANSWER Martin recorded the low temperatures at his house for one week. The temperatures are shown below.-7, -3,4,1, -2,-8,7Approximately what was the average low temperature for the week?