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.
Python Create Loop 1 = 1 1 + 2 = 3 1 + 2 + 3...
Python Create Loop 1 = 1 1 + 2 = 3 1 + 2 + 3 = 6 1 + 2 + 3 + 4 = 10 1 + 2 + 3 + 4 + 5 = 15 Create a loop in python that makes this pattern
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)...
Task 2: Debugging and writing functions In IDLE, use the File -> New Window menu option...
Task 2: Debugging and writing functions In IDLE, use the File -> New Window menu option to open a new editor window for your program, and save it using the name hw4Task2.py. Make sure to specify the .py extension. Copy the following (buggy) code into that file: def mysum(x, y) """ takes two numbers and returns their sum """     total = x + y     print(total) Save the file using Ctrl-S. Then try to run it using F5. What...
​​​​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...
1. Write a program that will do file processing. 2. First, create a data file (A7_in.txt)....
1. Write a program that will do file processing. 2. First, create a data file (A7_in.txt). It can contain any number (no fewer than 3) integers, each integer on it’s own line. 3. Your program will read and sum each integer until the EOF. 4. Your program will then find the average of the integers and output the average to another file (A7_out.txt). c++
Create a new Python 3 Jupyter Notebook. Create one python code cell for the problem below....
Create a new Python 3 Jupyter Notebook. Create one python code cell for the problem below. Use any additional variables and comments as needed to program a solution to the corresponding problem. All functions should be defined at the top of the code in alphabetical order. When done, download the ipynb file and submit it to the appropriate dropbox in the course's canvas page. Problem: Define a function with the following characteristics: The function's purpose will be calculating a factORRial...
create a new Python 3 Jupyter Notebook.. Create one python code cell for the problem below....
create a new Python 3 Jupyter Notebook.. Create one python code cell for the problem below. Use any additional variables and comments as needed to program a solution to the corresponding problem. All functions should be defined at the top of the code in alphabetical order. Problem: Define a function with the following characteristics: The function's purpose will be checking that a number matches another, so it should be named appropriately. It must accept one parameter, which is the number...
In Python, create a program with 2 classes that do the following. HashCreate class, this class...
In Python, create a program with 2 classes that do the following. HashCreate class, this class will accept a directory and hash each file in the directory and store the results in a dictionary. The dictionary will contain the hash value and file name. HashVerify, the second class will accept the dictionary as input and save that in an instance attribute. This class must also contain a method for lookups that require a file path as input. The lookup method...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT