Question
The language is Python and there is more than one input.
Instructions from your teacher: Instructions Prompt for a string and cut it into two equal parts (If the length of the stri
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1 2 # taking user input s = input(Enter a string: ) 4 5 # calculating half half = int(len(s)/2) 7 8 # printing output print

Result executed in 3.029 sec(s) Beute in 3.029 secs Enter a string: bigboy boybig

CODE

# taking user input
s = input("Enter a string: ")

# calculating half
half = int(len(s)/2)

# printing output
print(s[half:] + s[:half])

#please up vote

Add a comment
Know the answer?
Add Answer to:
The language is Python and there is more than one input. Instructions from your teacher: Instructions...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that prompts a user for an input string of length at least two...

    Write a program that prompts a user for an input string of length at least two and prints the string with the first half in upper case and the second half in lower case. If the length of the string is odd, the "second half" should be one character longer than the "first half". Show Hint

  • This Python module will be menu driven and use conditions to check user input in order...

    This Python module will be menu driven and use conditions to check user input in order to determine which operation to perform based on the user’s menu selection. The output should look like the attached example output. The menu will have the following selections (NOTE: all menu selections by the user should not be case sensitive) : 1. ‘CC’ – Character Count a. This operation will prompt the user for a string b. The number if characters will be counted...

  • Task 1: Calling a Function PROGRAM IS IN PYTHON) SHOW INPUT AND OUTPUT SCREEN SHOTS Task...

    Task 1: Calling a Function PROGRAM IS IN PYTHON) SHOW INPUT AND OUTPUT SCREEN SHOTS Task 1: Calling a Function Defining a function gives it a name, specifies the parameters that are to be included in the function and structures the blocks of code. Once the basic structure of a function is finalized, you can execute it by calling it from another function or directly from the Python prompt. Following is an example to call the printme() function #!/usr/bin/python 3...

  • the language is in Python please help Instructions from your teacher. Instructions The US Population.txt file...

    the language is in Python please help Instructions from your teacher. Instructions The US Population.txt file contains the midyear population of United States, in thousands, during the years 1950 through 1990. The first line in the file contains the population for 1950, the second line contains the population for 1951, and so forth. Create an application that reads the file's contents into a list. The application should do the following: • (15 points) Read the file into an list of...

  • please help, language is python You’re creating a secret code to share with your friends such...

    please help, language is python You’re creating a secret code to share with your friends such that every word should be written with the second and last letters swapped. Write a function called encode that receives a string (input) and prints out another string with the second and last letters swapped. Example function calls: encode(secret) # should print “the code for secret is stcree” encode(city) # should print “the code for city is cyti”

  • This works as expected BUT when I enter a input that is incorrect more than one...

    This works as expected BUT when I enter a input that is incorrect more than one time, the second time it stops works. It works as expected and redisplays the prompt after the first time an exception is raised but crashes the second. Any help appreciated! ------------------------------------------------------------------------- # This program will open and read a list of numbers in a text file and then terminate def nums():    prompt = input("Please enter the name of your file: ")      read_numbers...

  • TASK Your task is to build a palindrome from an input string. A palindrome is a...

    TASK Your task is to build a palindrome from an input string. A palindrome is a word that reads the same backward or forward. Your code will take the first 5 characters of the user input, and create a 9- character palindrome from it. Words shorter than 5 characters will result in a runtime error when you run your code. This is acceptable for this exercise – we will cover input validation in a later class. Some examples of input...

  • 3. Write Python statements that will do the following: a) Input a string from the user....

    3. Write Python statements that will do the following: a) Input a string from the user. *** Print meaningful messages along with your output.* b) Print the length of the String. Example input: The sky is blue. Correct output: The length of the string is 16 Incorrect output: 16 c) Print the first character of the string. d) Print the last character of the string. 4. Save the program. Double-check the left edge for syntax errors or warning symbols before...

  • In either Java or Python 3, write a program that simulates a deterministic FSM. It will read from two input files. The first is a file describing an FSM The first line contains the alphabet as a seri...

    In either Java or Python 3, write a program that simulates a deterministic FSM. It will read from two input files. The first is a file describing an FSM The first line contains the alphabet as a series of characters separated by a single space - The second line contains the number of states as an integer k 2 1; states will be numbered 0,1,..., k -1. The start state is always state O The third line contains a series...

  • In either Java or Python 3, write a program that simulates a deterministic FSM. It will read from two input files. The first is a file describing an FSM The first line contains the alphabet as a seri...

    In either Java or Python 3, write a program that simulates a deterministic FSM. It will read from two input files. The first is a file describing an FSM The first line contains the alphabet as a series of characters separated by a single space - The second line contains the number of states as an integer k 2 1; states will be numbered 0,1,..., k -1. The start state is always state O The third line contains a series...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT