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
I am Lyosha [343]
3 years ago
13

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
Computers and Technology
1 answer:
Elenna [48]3 years ago
3 0

Answer:

In Python:

def swap(number1,number2):

   a = number1

   number1 = number2

   number2 = a

   return number1, number2

   

first = float(input("First Number: "))

second = float(input("Second Number: "))

print("After Swap: "+str(swap(first,second)))

Explanation:

The swap function begins here

def swap(number1,number2):

This saves number1 into variable a

   a = number1

This saves number2 into number1

   number1 = number2

This saves a (i.e. the previous number1) to number2

   number2 = a

This returns the numbers (after swap)

   return number1, number2

   

The main begins here

The next two lines prompt the user for first and second numbers

<em>first = float(input("First Number: "))</em>

<em>second = float(input("Second Number: "))</em>

This calls the swap function and print their values after swap

print("After Swap: "+str(swap(first,second)))

You might be interested in
What is boot sector virus​
Galina-37 [17]

Answer:

Boot Sector virus is when a virus infects the Boot Sector of a hard disk. A Boot Sector is the initial files necessary to start an OS and other bootable programs. It is typically infected by these viruses when started with infected floppy disks, however the boot virus does not have to be successful to infect your computer. Once infected, the virus tries to infect every other disk.

Hope this helps!

4 0
1 year ago
What need most led to the creation of the Advanced Research Projects Agency Network? DARPA wanted scientists to be able to colla
Bas_tet [7]

(A) DARPA wanted scientists to be able to collaborate and share research easily.

The initial purpose of ARPA was to enable mainly scientific users at the connected institutions to communicate and share resources, also to be able to link computers at Pentagon-funded research institutions over telephone lines, and it became the technical foundation of the Internet.

6 0
3 years ago
Read 2 more answers
Alternating Current or AC is better for use in ___________, while DC direct current is needed in _________ .
PIT_PIT [208]
<span>C electric power transmisson and electronics</span>
6 0
2 years ago
Read 2 more answers
Digital citizenship is both a right and a {Blank}.
wolverine [178]
Privilege, I believe.
Hope this helps!<span />
6 0
3 years ago
Read 2 more answers
A type of specialty processor devoted exclusively to protecting your privacy.
drek231 [11]
 Cryptoprocessor would be it.
8 0
3 years ago
Read 2 more answers
Other questions:
  • Damion recently did an update to his computer and added a new video card. After the update, Damion decided that he would like to
    13·1 answer
  • what properties are associated with all Microsoft Office files and include author, title, and subject
    5·1 answer
  • The unique global address for a web page or other resource on the internet is called the ________.
    7·1 answer
  • Host to IP address lookup and its reverse lookup option are very important network services for any size network. It is also how
    14·1 answer
  • A superscope is a special type of scope that allows a dhcp server to service multiple ipv4 subnets on multiple physical networks
    7·1 answer
  • How does virtualization factor into a layered vs. non-layered design discussion?
    14·2 answers
  • Write a program that allows the user to enter a time in seconds and then outputs how far an object would drop if it is in free f
    7·1 answer
  • 01:24:3
    11·1 answer
  • We can find out how robots work by looking in detail at the smaller parts. What do we call this?
    6·1 answer
  • As part of your regular system maintenance, you install the latest operating system updates on your Windows 10 computer. After s
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!