Write a function called backwards that takes in one string

Assignment Help Python Programming
Reference no: EM132360745

Part 1 : String Manipulation

For this part, your group will be creating 4 functions.

Question 1

Write a function called backwards that takes in one string as a parameter. The function return a new string. The returned string should just be the original string, but in reverse order.
Examples:
>>> a = backwards("School")
>>> print(a) loohcS
>>> b = backwards("cat")
>>> print(b) tac

Question 2

Write a function called abbreviator that takes in one string as a parameter. The function should return a new string. The returned string should contain only the capital letters and numbers from the original string. Make sure that your returned string does not contain any special characters such as periods, semicolons, apostrophe's, spaces, etc.
(Hint: the isalpha() and isupper() functions may help)
Examples:
>>> a = "If You're Reading This It's Too Late"
>>> b = abbreviator(a)
>>> print(b)
IYRTITL
>>> c = "Hotline Sling part 2"
>>> d = abbreviator(c)
>>> print(d)
HB2

Part 2

Question 1

Write a function called evenOdd that takes in a list of random elements. This function should return a new string. For every string located at an even position within the list (count the Oth index as even), you will take the first vowel (a,e,i,o,u) out of the string and add it to the new string. For every string located at an odd position in the list, you will take first consonant out of the string and add it to the string. Treat y as a consonant. The returned string must be all lowercase. Do not process non- strings elements and ignore characters in strings that are not letters. Examples:
>» a = evenOdd(['car, 'Dog', False, 9, 'treat']) >>> print(a)
ade
>>> b = evenOdd(['Perfume', 'Kyary', 'pon-pon', True, None])
>>>print(b)
eko

Question 2

Write a function called parse that takes in two parameters: a string and a delimiter. Your function should return a list of separated strings depending on the delimiter. You may assume the delimiter will be a single character. Each string in the list should not contain the delimiter itself. You may not use any built-in Python functions such as the split function, instead, use iteration and conditionals.
Examples:
parse("This is a Sentence", " ") should return ['This', 'is', 'a', 'Sentence']
parse("f-r-i-e-n-d-s", "-") should return [1, 'r', 'P, 'e', 'n', 'd', 's']
parse("f,.5,.5",",") should return ['f', '.5',
parse("f„.5",",") should return [ ", (The 2nd element Is an empty
string).

Reference no: EM132360745

Questions Cloud

Compute the sum of the first n prime numbers : Write the statements needed to compute the sum of the first n prime numbers. The sum should be associated with the variable total.
Biological molecules of the concepts of biology text : Biological Molecules of the Concepts of Biology text, we learn about the four categories of macromolecules that form biological organisms.
Write a method that interprets the length of a time : Write a method that interprets the length of a Time as the number of seconds that have elapsed from midnight to the that time.
Define a function named future date that first take a string : Define a function named future_date that first takes a string as an argument ; its second argument is the number of days to "advance" the date into the future.
Write a function called backwards that takes in one string : Write a function called backwards that takes in one string as a parameter. The function return a new string. The returned string should just be the original.
Describe differing theories on organizational development : Describe differing theories on organizational development, motivation and needs theories, and then compare and contrast the theories by providing strengths
Describe the growth of business intelligence : CISM4000 - Accounting Information Systems - Kaplan Business School - Excel Assignment and Case Study - Describe the growth of Business Intelligence in the past
Business statistics data analysis : Data Analysis and Decision Making For Managers. Adolph Westphalia has recently been assigned to analyze the company's pricing policy.
Calculate the monthly average prices of apple stock : Calculate the monthly average prices of Apple stock from 1984 to 2013. A file of Apple's daily stock's prices will be given to you.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd