answer.
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
aniked [119]
1 year ago
15

Using range(1,101), make two list, one containing all even numbers and other containing all odd numbers. How can I do this on Py

thon
Computers and Technology
1 answer:
jeka941 year ago
4 0

Answer:

even = []

odd = []

for i in range(1,101):

if i % 2 == 0:

even.append(i)

else:

odd.append(i)

You might be interested in
Type the correct answer in the box. Spell all words correctly.
kvasek [131]

Answer:

Presentations?

Explanation:

6 0
2 years ago
(NumberFormatException)Write the bin2Dec(String binaryString) method to convert a binary string into a decimal number. Implement
tresset_1 [31]

The following program will be used that prompts the user to enter a binary number as a string and displays decimal equivalent of the string.

<u>Explanation:</u>

NumberFormat.java

import java.util.Scanner;

public class NumberFormat{

public static void main(String[] args) {

      Scanner scan = new Scanner(System.in);

      try{

      System.out.println("Enter a binary string:");

      String s = scan.next();

      int integerValue = bin2Dec(Integer.parseInt(s));

      System.out.println("The decimal value of "+s+" is "+integerValue);

      }

      catch(NumberFormatException e){

          System.out.println(e);

      }

  }  

  public static int bin2Dec(int binaryNumber) throws NumberFormatException{

  int decimal = 0;

  int p = 0;

  try{

  while(true){

  if(binaryNumber == 0){

  break;

  } else {

  int temp = binaryNumber%10;

  decimal += temp*Math.pow(2, p);

  binaryNumber = binaryNumber/10;

  p++;

  }

  }

  }

  catch(NumberFormatException e){

      throw new NumberFormatException("Invalid binary number");

  }

  return decimal;

  }

}

Output:

Enter a binary string:

1011000101

The decimal value of 1011000101 is 709

5 0
2 years ago
Anime question where do i watch Itadaki! Seieki! 100 points
EastWind [94]

Answer:

Crunchyroll or Funamation

Explanation:

8 0
2 years ago
Read 2 more answers
Mary has been locked out of her account after failing to correctly enter her password three times. As the system administrator,
Digiron [165]
Oh hey lol yea yea lol I got the money back to me put on the phone so you know
7 0
2 years ago
zybooks cis 110 challenge activity 9.8.1 Write a program that takes in a positive integer as input, and outputs a string of 1's
irakobra [83]

Answer:

public class IntegerToBinary

{

public static void main(String[] args) {

 integerToBinary(6);

}

public static void integerToBinary(int num){

    while(num > 0){

       System.out.print(num%2);

       num = Math.floorDiv(num, 2);

    }

}

}

Explanation:

*The code is in Java.

Create a function called integerToBinary that takes one parameter, num

Inside the function, create a while loop that iterates while the num is greater than 0. Inside the loop, print the num%2. Then, get the floor division of the num by to and assign it to the num.

Inside the main, call the function with parameter 6.

7 0
2 years ago
Other questions:
  • Donna often travels around the world. When she travels, she needs to access her emails from different locations. However, to kee
    6·2 answers
  • How efficient would a 6-bit code be in asynchronous transmission if it had 1 parity bit, 1 start bit, and 2 stop bits?
    5·1 answer
  • Which is true of case-based reasoning (CBR)?
    6·1 answer
  • Write a program that reads an integer and displays, using asterisks a filled and hollow square, placed next to each other. for e
    9·1 answer
  • Which of the following methods could be considered a "best practice" in terms of informing respondents how their answers to an o
    7·1 answer
  • What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
    12·1 answer
  • Consider the formula: G=D+(A+C^2)*E/(D+B)^3 Show the order that a processor would follow to calculate G. To do so, break down th
    10·1 answer
  • Assume you have a variable, budget, that is associated with a positive integer. Assume you have another variable, shopping_list,
    11·1 answer
  • Using virtualization comes with many advantages, one of them being performance. Which of these is NOT another realistic advantag
    7·1 answer
  • Interactive media professionals are unique among other Information Technology professionals because they have very good job pros
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!