Determining the upper-case characters

Assignment Help Basic Computer Science
Reference no: EM132290110

Complete the following program

Instructions:

1. Complete the function asn4_1(): accept two parameters-a string and an integer. Print the first character from the string; after that, print every nth character. If the string is "abcdefghijklmn" and the integer is 3, asn4_3() should print "adgjm". Use a loop-do not use string slicing.

2. Complete the function asn4_2(): given a name, return an acronym. For example, if the user enters James Tiberius Kirk, asn4_2() should return JTK. While the expectation is for the user to enter a name, the algorithm should return the first character of each word in the string - you can assume that words are separated by spaces (but the acronym should have no spaces). This function should return the acronym - it should not print it.

3. Complete the function asn4_3(): given a string, return (don't print) the number of characters in the string that are NOT digits.

4. Complete the function asn4_4(): given a string, extract all the upper-case characters in the string and make a new string from them. Return (don't print) the new string that has only the upper-case characters.

def asn4_1(s, n):

  '''Use a loop to print the first character in string s; after that,

    print every nth character

  '''

  pass #You can take this out or leave it; either way is ok

def asn4_2(s):

  '''

  Return the first character of every word in s (words are separated by

  spaces)

  '''

  pass

def asn4_3(s):

  '''

  Return the number of characters in s that are NOT digits

  '''

  pass #You can take this out or leave it; either way is ok

def asn4_4(s):

  '''Return a string consisting of all the upper case characters from s'''

  # new string and set it to empty string

  #For each character in s

  #  If the character is upper case

  #    Add it to the new string

  #Return the new string

  pass #You can take this out or leave it; either way is ok

def main():

  '''

  Don't change anything below this point.

  But you can comment out some of these statements if one of your

  functions is crashing your program.

  '''

  s = input("Please enter a string for ans4_1: ")

  asn4_1(s, 3)

  s = input("Please enter a string for asn4_2: ")

  print(asn4_2(s))

  s = input("Please enter a string for asn4_3: ")

  print(asn4_3(s))

  s = input("Please enter a string for asn4_4: ")

  print(asn4_4(s))

main() #Start execution

Reference no: EM132290110

Questions Cloud

Prominent component in a security policy : Acceptable Use Policy - AUP is a very prominent component in a Security Policy.
Exclusive-or of two regular languages is regular : Given two languages, L and M, define the exclusive-or of L and M as the set of all strings, w, such that w is in L and not in M or w is in M and not in L.
Concise description of product and company that produced : Give a Concise Description of Product and Company that produced The Echo and Alexa products.
Create a worksheet that display key performance indicators : Create a worksheet that display key performance indicators for sales by product subcategory/region.
Determining the upper-case characters : Complete the function asn4_1(): accept two parameters-a string and an integer. Print the first character from the string; after that, print every nth character
Wireless networks performance evaluation : MN603 - Wireless Networks and Security - Wireless networks performance evaluation - Design a wireless network consisting of 20 nodes; the dimensions
Pairs of numbers are relatively prime : Which of the following pairs of numbers are relatively prime? Show the calculations that led to your conclusions.
How often should ethics training take place : What actions do you recommend Rajah take about his concerns with respect to the new one-cent-in-change policy?
Define a transaction with respect to database systems : 1. Define a transaction with respect to database systems. 2. Define the transaction properties outlined by the acronym ACID.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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