1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dybincka [34]
3 years ago
14

Create a Python program in a file named loops1.py that does the following: a. Use a while loop to keep asking the user for input

until the length of the input is at least 10. b. When the user finally enters an input that is 10 or more characters, proceed as follows: i. If the length of the input is even, print the input string back in all lowercase. ii. If the length of the input is odd, print the input string back in all uppercase.
Computers and Technology
2 answers:
Rashid [163]3 years ago
7 0

Answer:

mystr = input("Enter a string ")

length = len(mystr)

while length<10:

   mystr = input("Enter a string ")

   length = len(mystr)

   if(length>=10):

       break

if len(mystr)%2==0:

   print(mystr.lower())

else:

   print(mystr.upper())

Explanation:

The variable mystr is used to save user's input which is received with the input function

A second variable length is used to save the length of the input string Using a while statement the user is continually prompted to enter a string while length is less than 10.

If length is greater or equal to 10. We check for even or odd using the modulo (%) operator.

We use lower() and upper() to change the case of the string

Mandarinka [93]3 years ago
5 0

Answer:

myvalue = input("please input your value: ")

while len(myvalue) < 10 :

      myvalue = input("please input your value: ")

      if len(myvalue) >= 10:

               break

if len(myvalue)%2 == 0:

      print(myvalue.lower())

else:

       print(myvalue.upper())

Explanation:

Create a python program file and name the file as loops1.py in accordance to what the question stated. Note to run this file you must have installed python software on your system.

Interpreting the code,

myvalue = input("please input your value: ") simply prompt the user to input a value .

while len(myvalue) < 10 : and  myvalue = input("please input your value: ")  This is a while loop that prompts the user to input another values if the initial value length inputted is less than 10.

if len(myvalue) >= 10: If the length of the value is equal or greater than 10 then the break  statement terminates the while loop entirely.

if len(myvalue)%2 == 0:  If the length of the value inputted divided by 2 is equal to 0, the lower case version(print(myvalue.lower())) of the value is printed out.

else:  

The uppercase value is printed( print(myvalue.upper()))

NOTE python use indentation.

You might be interested in
What are the network topologies? Advantages and disadvantages.
s344n2d4d5 [400]
Network topology is the arrangement of the elements of a communication network. Network topology can be used to define or describe the arrangement of various types of telecommunication networks, including command and control radio networks, industrial fieldbusses and computer networks.

Advantages:

It is easy to handle and implement.

It is best suited for small networks.

Disadvantages:

The cable length is limited. This limits the number of stations that can be connected.

This network topology can perform well only for a limited number of nodes.
6 0
2 years ago
One way to prepare for filing the PROFILE is to:
kozerog [31]
I think I am not sure that it is probably b
8 0
3 years ago
Read 2 more answers
This feature in Word Online allows you to view your document to see what it will look like when printed.
kherson [118]

Answer:

Print preview allows you to view your document before printing

7 0
3 years ago
Read 2 more answers
Which format is best for the image below?
fredd [130]
I’m pretty sure it’s PNG
3 0
3 years ago
Free point giveaway pt.10 and brainliest to first answer
g100num [7]

Answer:

3+3=6

Explanation:

Tysm!!!

8 0
2 years ago
Read 2 more answers
Other questions:
  • "what is the #1 resource used when researching a product online?"
    5·1 answer
  • What is the value of variable num after the following code segment is executed?
    5·1 answer
  • Which CSS attribute would change an element's font color to blue
    15·2 answers
  • A. Calculate the diffusion coefficient for magnesium in aluminum at 450°C.
    14·1 answer
  • The loop function is similar to range(), but handles the parameters somewhat differently: it takes in 3 parameters: the starting
    14·1 answer
  • The biggest limitation of a network operating system (NOS) is _____ in terms of memory, process, device, and file management.
    7·1 answer
  • If a movie, song, or book is offered for free, is it malware?
    15·1 answer
  • What is the meaning of s used in 0 and 1 in computer .​
    8·1 answer
  • with a ____ the traffic of a given enterprise or group passes transparently through an internet in a way that effectively segreg
    13·1 answer
  • Assume that an int variable age has been declared and already given a value. Assume further that the user has just been presente
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!