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
vekshin1
3 years ago
10

In this exercise, you'll raise a manual exception when a condition is not met in a particular function. In particular, we'll be

converting birth year to age. Specifications One a new cell in your notebook, type the following function >>> import datetime >>> class InvalidAgeError(Exception): pass >>> def get_age(birthyear): age = datetime.datetime.now().year - birthyear return age Add a check that tests whether or not the person has a valid (0 or greater) If the age is invalid, raise an InvalidAgeError Expected Output >>> get_age(2099) Traceback (most recent call last): File "", line 1, in __main__.InvalidAgeError
Computers and Technology
1 answer:
Shtirlitz [24]3 years ago
8 0
Dhjejekewk that’s a lot
You might be interested in
CAN SOMEONE DO OR LOOK UP THE PIE CHART FOR THIS ANSWER PLS AND I WILL MARK YOU BRAINLIEST BUT PLSSS HELP MEEEE!!!
beks73 [17]

Answer:

I highly recommened you use ggl charts.

Explanation:

It's free. ALL YOU NEED IS AN GGL ACCOUNT. You can also choose many types of graph you want.

4 0
3 years ago
1. Write an application that prompts the user to enter the size of the side of a square, and then displays a hollow square of th
belka [17]

Answer:

import java.util.Scanner;

public class HollowSquare

{

public static void main(String args[])

{

Scanner scan = new Scanner(System.in);

int size;

System.out.print("Enter the size : ");

size = scan.nextInt();

if(size>=1 && size<=20)

{

for(int i=0; i<size; i++)

{

for(int j=0; j<size; j++)

{

if(i==0 || j==0 || i==size-1 || j==size-1)

System.out.print("*");

else

System.out.print(" ");

}

System.out.println();

}

}

else

System.out.println("Invalid size.");

}

}

4 0
3 years ago
Write a "for loop" that displays a string in the reverse order (DO NOT use the reverse method) 3.
elena55 [62]

Following are the code in java to reverse any string without using reverse function.

import java.util.*; // import package

class Main // class

{

public static void main(String args[])  // main class in java

{

String s, r = "";  // string variable

Scanner out = new Scanner(System.in);  // scanner classes to take input

System.out.println("Enter a string to reverse");

s = out.nextLine();  // input string

int l1 = s.length();  // finding length of string

l1=l1-1;

for ( int i = l1 ; i >= 0 ; i-- )  // for loop to reverse any string

{

r = r + s.charAt(i);

}

System.out.println(" The Reverse String is: "+r);  // print reverse string

  }

}

Explanation:

firstly we input any string ,finding the length of that string then after that iterating over the loop by using for loop and last display that reverse string

output

Enter a string to reverse

san ran

The Reverse String is: nar nas

5 0
4 years ago
As in previous prelabs, you can enter all the necessary Java code fragments into the DrJava Interactions pane. If you get an err
yuradex [85]

Answer:

public class Main{

public static void main(String[] args) {

 //The While Loop

 int i = 1;

 int sum = 0;

 while(i <=10){

     sum+=i;

     i++;  }

 System.out.println("Sum: "+sum);

 //The for Loop

 int summ = 0;

 for(int j = 1;j<=10;j++){

     summ+=j;  }

 System.out.println("Sum: "+summ); } }

Explanation:

The while loop begins here

 //The While Loop

This initializes the count variable i to 1

 int i = 1;

This initializes sum to 0

 int sum = 0;

This while iteration is repeated until the count variable i reaches 10

 while(i <=10){

This calculates the sum

     sum+=i;

This increments the count variable i by 1

     i++;  }

This prints the calculated sum

 System.out.println("Sum: "+sum);

The for loop begins here

 //The for Loop

This initializes sum to 0

 int summ = 0;

This iterates 1 through 10

 for(int j = 1;j<=10;j++){

This calculates the sum

     summ+=j;  }

This prints the calculated sum

 System.out.println("Sum: "+summ); }

5 0
3 years ago
Using word, which tool are best to place <br> images in word and why
stellarik [79]

Answer:

i know

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Software license infringement is also often called software __________.
    11·2 answers
  • I'm trying to connect fire stick but it doesn't have HDMI input so guys what would do you recommend to buy I tried a converter b
    8·1 answer
  • _________ are represented using diamonds linked withparticipant ETs
    6·1 answer
  • Which of these is NOT one of the main parts of an email? A. Header B. Subject C. Body D. Reply
    11·2 answers
  • Which role will grant a delegate read-only access to a particular workspace within a user’s Outlook mailbox?
    15·2 answers
  • Implication of technological literacy to a teacher training today
    13·1 answer
  • A reference parameter differs from an output parameter in that a reference parameter ______________________ but an output parame
    5·1 answer
  • Write a method called classAttendence() that creates a 10-by-10 two-dimensional array and asks for user input to populate it wit
    14·1 answer
  • 20 examples of input device?
    9·2 answers
  • Assume the size of an integer array is stored in $s0 and the address of the first element of the array in the memory is stored i
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!