Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Python
Read from the user a string containing
odd number of characters. Your program should:
a) Print the middle character.
b) Print the string up to but not including the middle character (i.e., the first half
of the string).
c) Print the string from the middle character to the end (not including the
middle character).
Sample output:
Enter an odd length string: Fortune favors the bold
Middle character: o
First half: Fortune fav
Second half: rs the bold
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 4 images
Knowledge Booster
Similar questions
- Help? Using python, write a program that lets the user enter a string and displays the character that appears most frequently in the string. Should i start with string lower?arrow_forwardThe expressions string[0] and string[:1] are the same. Select one: True Falsearrow_forwardQuestion 1 a) Use pseudocode to describe an algorithm that counts the number of letters, digits and special characters in a string. Anything between 'a' or 'A' and 'z' or 'Z' is considered a letter, anything between 0 and 9 is considered a digit, while anything else is considered a special character. Input: a string s read from the keyboard, for example s = '3 beautiful days.' Output: letter count / = 13, digit count d = 1, special character count c = 3 For solving this task, consider the string to be an array of characters and do not use any predefined functions that would make this task trivial. b) Show an implementation of the algorithm designed in the language of your choice. You will not be penalised for small syntactical errors. c) Implement an algorithm in the language of choice that counts the occurrence of a digit in a number recursively. Input: a number n read from the keyboard, for example n = 30563323 a digit d the occurrences of which should be counted, for example d = 3…arrow_forward
- Lab Activity for the students: Exercise 5: Write a program that asks the user to input a letter. The program finds and prints if the letter is uppercase or lowercase. Then, the program asks the user to input a string and get a three-character substring from the beginning of the string. (1 Mark ) Example : If the inputs are 'y' and "Community". Then, the program will print: y is lowercase The substring is: Comarrow_forwardPython program that accepts a string and calculates the number of digits and letters..arrow_forwardPYTHON QUESTION Use f-strings and psuedocode program2_1.pyWrite a program that calculates weekly pay, disregarding overtime. Assign an hourly pay rate of 27.50 to a properly named constant (see page 80). Prompt the user to enter the weekly hours worked. The hours might not be an integer. Calculate the weekly pay and display it as currency using an f-string. Currency format means two decimal places and a comma for pay in excess of $1,000.00.arrow_forward
- I neeh help on Completing this program that prints the position of the last lowercase vowel (a, e, i, o, or u) in a string. Print -1 if the word has no lowercase vowels.arrow_forwardC PROGRAMarrow_forwardDesign an algorithm or function to find the longest substring which contains 2 unique characters in a given string. You may list steps or psuedo code. Example: In the string "abaacacaacda" return "aacacaac"arrow_forward
- PYTHON PROGRAMMING EXERCISE-1 Read input two strings x, y from the user and concatenate the first 5 characters of both the strings x, y and display the string formed in the output. You can assume that both the strings are greater than length 5.arrow_forwardAccessing a single character out of a string is called:a) slicing b) concatenation c) assignment d) indexingarrow_forwardHow is a String different from a basic data type (such an int, double, or boolean)?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY