Question

Please write the following in python 3 Also please share your code and soltion Given two...

Please write the following in python 3

Also please share your code and soltion

Given two variables, firstPlace and secondPlace, write some code that swaps (switches) their associated values. Use additional variable(s) as necessary (NOTE: Do not use any predefined swap function!)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

input code:

output:

code:

'''take value from user'''
firstPlace=float(input("Enter value for firstPlace:"))
SecondPlace=float(input("Enter value for SecondPlace:"))
'''swap the associate value'''
temp=firstPlace
firstPlace=SecondPlace
SecondPlace=temp
'''print the variables'''
print("firstPlace value is : ",firstPlace)
print("SecondPlace value is : ",SecondPlace)

Add a comment
Know the answer?
Add Answer to:
Please write the following in python 3 Also please share your code and soltion Given two...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Please write the following in Python 3 code. Also, write code and not psedo code....

    1. Please write the following in Python 3 code. Also, write code and not psedo code. Also, show all outputs and share your code. Question: Create one conditional so that if “Friendly” is in w, then “Friendly is here!” should be assigned to the variable wrd. If it’s not, check if “Friend” is in w. If so, the string “Friend is here!” should be assigned to the variable wrd, otherwise “No variation of friend is in here.” should be assigned...

  • 1. Please write the following code in Python 3. Also please show all output(s) and share...

    1. Please write the following code in Python 3. Also please show all output(s) and share your code. Below is a for loop that works. Underneath the for loop, rewrite the problem so that it does the same thing, but using a while loop instead of a for loop. Assign the accumulated total in the while loop code to the variable sum2. Once complete, sum2 should equal sum1. sum1 = 0 lst = [65, 78, 21, 33] for x in...

  • please write in python. thank you In this question you will be writing the code to...

    please write in python. thank you In this question you will be writing the code to carry out a query on a database table in Python. The CREATE command shown below is given just for your reference, so that you know the structure of the table and its columns. The database is an SQLite database in the file named taxa.sqlite. create table species ( id int primary key, genus varchar ( 5 0 ), species varchar(50), common_name char(100) ) Write...

  • Please solve the following in Python 3 only. Also, share code and show output. A software...

    Please solve the following in Python 3 only. Also, share code and show output. A software company sells a package that retails for $99. Quantity discounts are given according to the following table. Quantity Discount 10–19 20% 20–49 30% 50–99 40% 100 or more 50% Write a program that asks for the number of units sold and computes the total cost of the purchase. Input Validation: Make sure the number of units is greater than 0.

  • 1. Pleae write the following code in Python 3. Also, please show all the outputs. ....

    1. Pleae write the following code in Python 3. Also, please show all the outputs. . Write a simple Rectangle class. It should do the following: Accepts length and width as parameters when creating a new instance Has a perimeter method that returns the perimeter of the rectangle Has an area method that returns the area of the rectangle Don't worry about coordinates or negative values, etc. Python provides several modules to allow you to easily extend some of the...

  • In python please 4. Write the code that will define a function that takes any given...

    In python please 4. Write the code that will define a function that takes any given random number as input and it will check to see if that number given from the input is a prime number or not. (if you forgot what prime is from algebra, look it up)

  • please help, language is python You’re creating a secret code to share with your friends such...

    please help, language is python You’re creating a secret code to share with your friends such that every word should be written with the second and last letters swapped. Write a function called encode that receives a string (input) and prints out another string with the second and last letters swapped. Example function calls: encode(secret) # should print “the code for secret is stcree” encode(city) # should print “the code for city is cyti”

  • Python please Write a function print_back_upper() that accepts a string my_str as an argument and displays...

    Python please Write a function print_back_upper() that accepts a string my_str as an argument and displays the string backwards and in uppercase, all in one line (Note: Create any necessary variables) For example: if my_str = "Python" then, your output should display as follows: NOHTYP (Hint: You can use for loop navigating up to range of len of string-1, -1, -1 and use reverse() and upper() functions to create and display the string backwards in uppercase)

  • Write the code in PYTHON and please provide the full code, thank you! Write a program...

    Write the code in PYTHON and please provide the full code, thank you! Write a program that plots two functions: f(x) = x2 and g(x) = ax. Write it in such a way that the intersection points are marked with an X, for arbitrary a. • You may use your favorite ready-made function to find the intersection points, if not: • One possible way to tackle this problem is to put both function values in arrays and check using a...

  • please use python to write your code and explain your steps, thanks Consider the following table....

    please use python to write your code and explain your steps, thanks Consider the following table. It shows the data on the velocity of an object v as a function of timet 4 12 16 20 24 v [ms034.7 61.8 82.8 99.2112.0121.9 129.7 135.7 140.4

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT