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
stiks02 [169]
3 years ago
9

Write a program that will read two floating point numbers (the first read into a variable called first and the second read into

a variable called second) and then calls the function swap with the actual parameters first and second. The swap function having formal parameters number1 and number2 should swap the value of the two variables.
Sample Run:
Enter the first number
Then hit enter
80
Enter the second number
Then hit enter
70
You input the numbers as 80 and 70.
After swapping, the first number has the value of 70 which was the value of the
second number
The second number has the value of 80 which was the value of the first number
Computers and Technology
1 answer:
Oksana_A [137]3 years ago
3 0

Answer:

The program in Python is as follows:

def swap(number1,number2):

   number1,number2 = number2,number1

   return number1, number2

   

first = int(input("First: "))

second = int(input("Second: "))

print("You input the numbers as ",first,"and",second)

first,second= swap(first,second)

print("After swapping\nFirst: ",first,"\nSecond:",second)

Explanation:

This defines the function

def swap(number1,number2):

This swaps the numbers

   number1,number2 = number2,number1

This returns the swapped numbers

   return number1, number2

The main begins here

This gets input for first    

first = int(input("First: "))

This gets input for second

second = int(input("Second: "))

Print the number before swapping

print("You input the numbers as ",first,"and",second)

This swaps the numbers

first,second= swap(first,second)

This prints the numbers after swapping

print("After swapping\nFirst: ",first,"\nSecond:",second)

You might be interested in
What should the shutter speed be on the camera?<br> A. 1/30<br> B. 1/50<br> C. 1/60<br> D. 1/15
11Alexandr11 [23.1K]

Answer:

C. 1/60

Explanation:

Shutter speed is most commonly measured in fractions of a second, like 1/20 seconds or 1/10 seconds. Some high-end cameras offer shutter speeds as fast as 1/80 seconds. But, shutter speeds can extend to much longer times, generally up to 30 seconds on most cameras.

But in this case C. 1/60 is the answer.

6 0
3 years ago
Harrison works in a manufacturing unit and oversees the logistics, including the daily shipping of a large number of packages. W
Nookie1986 [14]

E. Transaction processing system

Explanation:

He will need a transaction processing system to know the amount of logistics available daily and how many to ship and how many to order.

Transaction processing system will make him keep track of what transactions take place during the various days to help him give a good report.

8 0
3 years ago
Read 2 more answers
Why should you evaluate trends when thinking about a career path?
Vladimir [108]

Because trends can show data in relation to what career is on the rise in terms of wages, statistics show patterns that you can observe to find the career which is becoming popular and most beneficial.  

3 0
4 years ago
The function below takes one parameter: a list of strings (string_list). Complete the function to return a new list containing o
Radda [10]

Answer:

def short_strings(string_list):

   short_list = []

   for s in string_list:

       if len(s) < 20:

           short_list.append(s)

   return short_list

Explanation:

* The code is in Python.

- Create a function called short_strings that takes one parameter, string_list

- Create an empty list called short_list to hold the strings that are less than 20 characters

- Initialize a for loop that iterates through the string_list. Check if there are strings that are less 20 characters in the string_list. If found, put them in the short_list

- Return the short_list

4 0
4 years ago
What is the difference between ordered list and unordered list?
VladimirAG [237]

Answer:

In an ordered list, each item is displayed along with the numbers or letters instead of bullets

In an unordered list, each item is displayed with a bullet.

5 0
3 years ago
Other questions:
  • Jill edited James's document using Track Changes. James agrees with all of the edits and wants to incorporate them into his text
    6·1 answer
  • Write a function decimalToBinaryRecursive that converts a decimal value to binary using recursion. This function takes a single
    11·1 answer
  • Why is it important to use correct posture while typing
    7·1 answer
  • Nathan wants to create multiple worksheet containing common formatting styles for his team members. Which file extension helps h
    9·1 answer
  • How many of yall are willing too sub to my channel called "Space Juice" with around 200 subs?!​
    14·1 answer
  • David Griffin on How Photography Connects Us
    11·1 answer
  • Your program has a loop. You want to exit the loop completely if the user guesses the correct word.
    6·2 answers
  • When a client PC is booted, it broadcasts a __________________________ message over the network to locate DHCP servers on the sa
    13·1 answer
  • kidede secondary school in Kotido district has been selected to participate in the final continental debating competitions with
    9·2 answers
  • Identify an internal user who uses product lifecycle management (plm) software and its data.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!