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
WITCHER [35]
3 years ago
8

Write a function swaparrayends() that swaps the first and last elements of the function's array parameter. ex: sortarray

Computers and Technology
1 answer:
Katena32 [7]3 years ago
3 0
Def swapArrayEnds( array ):
    tmp = array[ len( array ) - 1 ]
    array[ len( array ) - 1 ] = array[ 0 ]
    array[ 0 ] = tmp


You might be interested in
6. According to camp policy, staff members need to be at least 23 years old to transport students. Dean now wants to determine h
Kamila [148]

Answer:

This seems to be related to MS Excel, here we will discuss the related formula:

<u>=IF(VLOOKUP("Adam Moriarty",$B$3:$C$5,2)>23,"Yes","No")</u>

the name can also be written in adjacent to J2 cell i.e. I2 and its reference to be used in vlookup primary key as follows:

<u>=IF(VLOOKUP(I2,$B$3:$C$5,2)>23,"Yes","No")</u>

Explanation:

We have used simple IF function combined with VLOOKUP function to reference this formula to the table of names and ages of the members (here the table is $B$3:$C$5 and ages are mentioned in 2nd column of the table)

please find attached screenshot for clarification

6 0
3 years ago
2.13 LAB: Branches: Leap Year
Neporo4naja [7]

Answer:

The program in Python is as follows:

year = int(input("Enter a year: "))

print(year,end=" ")

if year % 4 == 0:

  if year % 100 == 0:

      if year % 400 == 0:           print("is a leap year")

      else:           print("is not a leap year")

  else:       print("is a leap year")

else:   print("is not a leap year")

Explanation:

This gets input for year

year = int(input("Enter a year: "))

This prints year, followed by a blank

print(year,end=" ")

If year is divisible by 4

if year % 4 == 0:

If yes, check if year is divisible by 100

  if year % 100 == 0:

If yes, check if year is divisible by 400; print leap year if true

      if year % 400 == 0:           print("is a leap year")

print not leap year if year is not divisible by 400

      else:           print("is not a leap year")

print leap year if year is not divisible by 100

  else:       print("is a leap year")

print leap year if year is not divisible by 4

else:   print("is not a leap year")

5 0
3 years ago
Is wireless or wired network faster??
bogdanovich [222]

Answer:

Wired

Explanation:

3 0
3 years ago
Read 2 more answers
Which type of function distill the information contained within a file (small or large) into a single fixed-length number, typic
Luda [366]
As far as I remember, message-digest functions distill the information contained within a file (small or large) into a single fixed-length<span>number, typically between 128 and 256 bits in length. This function is designed to protect the integrity of a piece of data to define changes to any part of a message.</span>
7 0
4 years ago
4.3 mini programs AP computer science
allochka39001 [22]

1.

name = input("Enter your name: ")

num1 = int(input("Hello "+name+ ", enter an integer: "))

num2 = int(input(name+", enter another integer: "))

try:

   if num1 % num2 == 0:

       print("The first number is divisible by the second number")

   else:

       print("The first number is not divisible by the second number")

except ZeroDivisionError:

   print("The first number is not divisible by the second number")

try:

   if num2 % num1 == 0:

       print("The second number is divisible by the first number")

   else:

       print("The second number is not divisible by the first number")

except ZeroDivisionError:

   print("The second number is not divisible by the first number")

2.

import random, math

num1 = float(input("Enter a small decimal number: "))

num2 = float(input("Enter a large decimal number: "))

r = round(random.uniform(num1, num2), 2)

print("The volume of a sphere with radius " + str(r) + " is " + str(round(((4 / 3) * math.pi * (r ** 3)), 2)))

I hope this helps!

8 0
3 years ago
Other questions:
  • Which of the following is an occupation management group? Select the choice that best answers the question.
    15·1 answer
  • Which protocol is often used to publish web pages to a web server?
    5·1 answer
  • Which statement prints "hi" on the screen?
    5·2 answers
  • E-fit and similar software compares what?
    7·1 answer
  • Which style of leadership would be most helpful to Charles in the following situation? Charles has just started an internship at
    15·1 answer
  • The ____ preceding a formula alerts excel that you are entering a formula or function and not text
    14·1 answer
  • Write a class named Accumulator containing: An instance variable named sum of type integer. A constructor that accepts an intege
    14·1 answer
  • Cómo se transmite la voz en el sistema telefónico?
    12·1 answer
  • Write an application named Hurricane that outputs a hurricane’s category based on the user’s input of the wind speed. Category 5
    7·1 answer
  • What is a database and provide 2 examples of how you are using a database.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!