Instructions for Individual Assignment: There are three questions in this assignment which require you to write and submit three Python scripts. Please save each script in two different...

1 answer below »

Instructions for Individual Assignment:



  • There are three questions in this assignment which require you to write and submit three Python scripts. Please save each script in two different formats:.pyand.txtprior to submission. For example, for the first question you need to submitcheckWord.
    pyandcheckWord.
    txt.

  • Combine all .pyand .txtfiles into one zip or rar file (6 files in total). Finally, upload your compressed file (zip or rar) to Black Board and proceed with submission.

  • Code must be appropriately commented. Make sure to add comments at each segment of your code to explain what it does. You may lose grades if you do not add comments.


  • Make sure that your code runs successfully for all possible entries.
    Hint:
    test your code against the examples given in the question (if any).

  • Try to approach the solution with the least number of steps. Your code must be clear, logical, and easy to understand.

  • Your code must be written in
    Python 3. You get no marks if the code is written in Python 2 or any other language.

  • All work must be submitted to Blackboard by the due date (Monday, 09 September 2019 11:55PM).

  • You are encouraged to avoid last minute submissions so that you do not run into technical difficulties.

  • You are allowed up to three attempts. All attempts must take place prior to assignment deadline.

  • Please note that the Self-check Safeassign link has been removed from Blackboard. You can still check your work for plagiarism by directly submitting your assignment. If the score for plagiarism is high, you are welcome to resubmit which will count as a second/third attempt.

  • Please note that plagiarism is treated seriously. All those caught plagiarising will get zero and get their names added to an institutional register. Remember, submitting genuine work and scoring lower is better than submitting non-genuine work and risking being added to the plagiarism watch-list.

  • than falling under the plagiarism watch-list.

  • Please download the attached submission template and see the step-by-step instructions for submission.

Answered Same DaySep 04, 2021

Answer To: Instructions for Individual Assignment: There are three questions in this assignment which require...

Neha answered on Sep 08 2021
134 Votes
44049/1.Reverse.py
import sys
#This method will reverse the string
def reverse(s):
return s[::-1]
#This method is used to check whether the original
#string and reverse string are same or not.
def isPalindrome(s):
# Calling reverse function
rev = reverse(s
)
# Checking if both string are equal or not
if (s == rev):
return True
return False
#This can be called as driver code.
#User will provide the input string.
string = input("Please enter a single word")
if len(string) == 0:
print("Blank Input")
print("Exiting....")
sys.exit()

result = isPalindrome(string)
if result == 1:
print(string,"can be read both ways")
else:
print(string,"can't be read both ways")
44049/2.Repeated_Punctuation.py
from collections import Counter
def remov_duplicates(input):
# split input string separated by space
input = input.split(" ")
# joins two adjacent elements in iterable way
for i in range(0, len(input)):
input[i] = "".join(input[i])
# now create dictionary using counter method
# which will have strings as key and their
# frequencies as value
UniqW = Counter(input)
# joins two adjacent elements in iterable way
s = " ".join(UniqW.keys())
print (s)
def Punctuation(string):
# punctuation marks
punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''

# traverse the given string and if any punctuation
# marks occur replace it with null
for x in string.lower():
if x in punctuations:
string = string.replace(x, "")
# Print string without punctuation
remov_duplicates(string)
# Driver program
string = input("Please enter your text")
Punctuation(string)
44049/3. Game.py
#This code is based on game. It runs in an indefinite loop.
#Two players can play this game. There are three characters
#out of which user #can choose one. If the user press enter
#without any value then the it exits from the loop.
print("Characters for the game are listed below please select one")
#indefinite loop
while True:
print("1.Dog")
print("2.Cat")
print("3.Mouse")
player1 = input("Player 1 please choose one character(1,2 or 3) or enter to exit")
#checking whether player 1 entered any value or not.
if not player1:
print("You pressed enter")
print("Exiting...")
break;
player2 = input("Player 2 please choose one character(1,2 or 3) or enter to exit")
#checking whether player 2 entered any value or not.
if not player2:
print("You pressed enter")
print("Exiting...")
break;
if(player1 =='1' and player2 =='2'):
print("Player 1 won")
elif(player1 == '2'...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here