Question

In: Computer Science

In IDLE - Python 3, do the following: 1. Create File --> New 2. Enter the...

In IDLE - Python 3, do the following:

1. Create File --> New
2. Enter the code below in the new file (you may omit the comments, I included them for explanation

#Python Code Begin

x = int(input("Enter a number: "))
y = int(input("Enter another number: "))

print ("Values before", "x:", x, "y:", y)

#add code to swap variables here
#you may not use Python libraries or built in swap functions
#you must use only the operators you have learned to use in this class so far
#you may use additional variables if you wish

print ("Values after ", "x:", x, "y:", y)

#Python Code End

3. File -->Save --> name the M5_FML_Tinker1.py

4. Run --> Run Module

Input: 5 6

Output:

Enter a number: 5
Enter another number: 6
Values before x: 5 y: 6
Values after x: 6 y: 5

Submission:

1. At the top of your Python code, add a comment with your name at the top of the file

     # FirstName LastName

2. Run it one more time to make sure you did not "break" the code.

3. Upload the M5_FML_Tinker.py file

Solutions

Expert Solution

Python program :

M5_FML_Tinker.py :

#Python Code Begin
#asking user to enter a number
x = int(input("Enter a number: "))
#asking user to enter another number
y = int(input("Enter another number: "))
#print the values of x and y
print ("Values before", "x:", x, "y:", y)
newVariable=x #storing value of x into newVariable
x=y #storing value of y into variable x
y=newVariable #storing value of newVariable into y
#print the values of x and y
print ("Values after ", "x:", x, "y:", y)
#Python Code End

**************************************

Please refer to the screenshot of the code to understand the indentation of the code :

**************************************

Output :


Related Solutions

Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program:...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program: Your program will create a username of your choice using a Kali Linux command "useradd -m mark", then set the password for that user using the Kali Linux Command "echo "mark:10101111" | chpasswd". Then you create a dictionary file using the Kali Linux command "crunch 8 8 01 > mylist.txt" Your python script should crack the password for that user and display on the...
Write functions in Python IDLE that do the following: i) A function that takes 2 arguments...
Write functions in Python IDLE that do the following: i) A function that takes 2 arguments and adds them. The result returned is the sum of the parameters. ii) A function that takes 2 arguments and returns the difference, iii) A function that calls both functions in i) and ii) and prints the product of the values returned by both.
Please use python and run in IDLE Question 1 Write functions that do the following: i)...
Please use python and run in IDLE Question 1 Write functions that do the following: i) A function that takes 2 arguments and adds them. The result returned is the sum of the parameters. ii) A function that takes 2 arguments and returns the difference, iii) A function that calls both functions in i) and ii) and prints the product of the values returned by both. Question 2 Write functions: i) One that prompts a user for 2 numbers. ii)...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create a variable named base_fee and set the value to 5.5. Prompt the user for the zone. The zones can be an integer value from 1 to any value for the zone. Convert the zone to an integer. Display the zone on the SenseHat with a scroll speed of 0.3, make the text blue, and the background yellow. Scroll "The zone is " and the...
python Create a new file name condition_quiz.py. Add a comment with your name and the date....
python Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is...
python Create a file named sales_bonus.py 2. Prompt the user for the amount of sales made,...
python Create a file named sales_bonus.py 2. Prompt the user for the amount of sales made, convert to a float, and assign to sales. 3. Prompt the user for number of days missed, covert to an int, and assign to days_missed 4. If the user have more than 3000 of sales and has missed less than or equal to two days of work, assign bonus to 100. 5.   Else if the user have more than 3000 of sales or has missed...
Create a Python program that: Reads the content of a file (Vehlist.txt) The file contains matching...
Create a Python program that: Reads the content of a file (Vehlist.txt) The file contains matching pairs of vehicle models and their respective makes Separate out the individual make and model on each line of the file Add the vehicle make to one list, and the vehicle model to another list; such that they are in the same relative position in each list Prompt the user to enter a vehicle model Search the list containing the vehicle models for a...
2. Add a title comment block to the top of the new Python file using the...
2. Add a title comment block to the top of the new Python file using the following form # A brief description of the project 3. Ask user - to enter the charge for food 4. Ask user - to enter theTip for server ( remember this is a percentage , the input therefore should be decimal. For example, for a 15% tip, 0.15 should be entered) 5. Ask user - to enter the Tax amount ( this is a...
Question 1: Using Python 3 Create an algorithm The goal is to create an algorithm that...
Question 1: Using Python 3 Create an algorithm The goal is to create an algorithm that can sort a singly-linked-list with Merge-sort. The program should read integers from file (hw-extra.txt) and create an unsorted singly-linked list. Then, the list should be sorted using merge sort algorithm. The merge-sort function should take the head of a linked list, and the size of the linked list as parameters. hw-extra.txt provided: 37 32 96 2 25 71 432 132 76 243 6 32...
do not use these: {,},{} Python 3 APPL 276.75 15 A file named asset.txt consists of...
do not use these: {,},{} Python 3 APPL 276.75 15 A file named asset.txt consists of only the three lines above. They describe the unit cost and quantity of shares of Apple stock. Write statement that open the file, read the data and use it to print this exact output: My APPL stock is worth $4,151.25.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT