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
Which layer defines an interface that applications can use to request network services, rather than referring directly to applic
Scrat [10]
Explain what is meant by a limited data set and how this HIPAA rule may affect medical assistants
4 0
3 years ago
Why might an algorithm created to assist in hiring decisions be biased?
nika2105 [10]

Answer:

Previous decisions were flawed

Explanation:

An algorithm depends entirely on the data input into the system in the decision making process.

As such, when there are conclusions in the data set used by the algorithm for decision making which are distorted, such as the association of less individuals that drink and drive in the rich cities than can be found in poorer communities due to the presence of less bars uptown and as such drivers from uptown areas are given preference may include a bias that is due to conclusion on which the previous decisions were made and used in the algorithm which may have been flawed or need more detailed analysis

4 0
3 years ago
Directions: pick the right letter for each number.
Ede4ka [16]

1. Upgrading RAM increases run speed.

2. Upgrading Hard Drive increases memory.

3. Adding more ROM to it..?

8 0
3 years ago
Read 2 more answers
A nursing informatics specialist is preparing an in-service program for staff on healthcare informatics and information technolo
Snezhnost [94]

Answer:

A- information

Explanation:

According to my research on nursing informatics specialists, I can say that based on the information provided within the question the nurse would emphasize information as the primary focus. This is because knowing what healthcare informatics entails as well as having the knowledge of how to use the technology is the most important aspect of the job.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
2 years ago
Visual Basics: 1 ) Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments
Lemur [1.5K]

Answer:

visual basic: 1)

Module PHmodule

   Sub Main()

       'Creating a variable for each entity

       dim ph as double = 0.0, neutral,base,acid as boolean

       'Writing a line to show user what to do

       console.writeline("Enter the pH :")

       'Taking the value

       ph=console.readline()

       'using if & elseif statement for distingushing the values into correct catagories

       if ph<7.0 then

       neutral=false:base=false:acid=true

       elseif ph>7.0 then  

       neutral=false:base=true:acid=false

       elseif ph=7.0 then

       neutral=true:base=false:acid=false

       end if

       'Printing the result

       console.writeline(" Neutral :" & Neutral)

       console.writeline(" base :" & base)

       console.writeline(" acid :" & acid)

       'command for staying in the command prompt for reading the result

       console.readline()

   End Sub

End Module

visual basic: 2)

Module AGEmodule()

  Sub Main()

       'Creating a variable for each entity

       dim age,minors,adults,seniors as integer = 0

       'Taking age from user

       console.writeline("Enter the age")

       age=console.readline()

       'using if & elseif statement for checking the age differnce

       if age<18 then'

       minors +=1

       else if age>18 and age<64 then

       adults +=1

       else if age>64 then  

       seniors +=1

       end if

       'printing result

       console.writeline("minors="&minors)

       console.writeline("adults="&adults)

       console.writeline("seniors="&seniors)

       'command for reading the result  

       console.readline()

  End Sub

End Module

Explanation:

visual basic 1) it is very simple program which allow us to find if the substance is acidic, basic or neutral. we use sim statement for making a variable as double (gives value in decimal) which allow to take a value from the user through console.readline() command and then by using the if statement we apply the condition if the ph is less then, greator then or equal to 7.0 value. thus the program gives us the answer. console.writeline() command is used to print a command on the screen while console.readline() command let us read the lines until we press enter.

visual basic 2)a program which allow us to count and add number of persons according to their age. we use dim statement for creating the variable as integers in which we take the age from user and then after checking it through if statement we increment according to three categories i.e. minors, adults, seniors. the console.writeline() command allow us to print anything on screen and console.readline() allowus to take value while compiling.

thank you...

6 0
3 years ago
Other questions:
  • Semiconductor memory is used mainly for primary storage even with its high cost. In another hand, the magnetic tape is the cheap
    6·1 answer
  • ________ is a software that interprets java bytecode.
    12·1 answer
  • A ____ by a design professional is used to determine the best system to provide the appropriate level and type of protection.
    6·1 answer
  • Which of the following is NOT a safe skill you can use to reduce your risk
    11·2 answers
  • Riya wants to save her project work in an external device so that she can show it to her class teacher. Help her to choose the d
    13·2 answers
  • If you want to transfer information transform STM to LTM, it is essential that you make the information ______________________.
    9·1 answer
  • How can a search be narrowed to only search a particular website????
    15·1 answer
  • One student will be stationed near you in a coffee shop. The other student will be located two miles away from your school. You
    10·2 answers
  • Launa is reviewing several videos from her friends doing the latest dance challenge before they are published on their own
    11·1 answer
  • Explain briely what this statement mean.<br>"A byte is equivalent to a character"<br>​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!