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]
2 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]2 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]2 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 do astronomers call a system that is composed of more than two stars?
Nezavi [6.7K]
Nazils system is the anwser
7 0
2 years ago
Read 2 more answers
(Palindrome integer) Write the methods with the following headers // Return the reversal of an integer, i.e., reverse(456) retur
Debora [2.8K]

Answer:

import java.util.Scanner;

public class PalindromeInteger {

public static void main(String[] args) {

 // Create an object of the Scanner class to allow for user's inputs

 Scanner input = new Scanner(System.in);

 // Create a prompt to display the aim of the program.

 System.out.println("Program to check whether or not a number is a palindrome");

 // Prompt the user to enter an integer number.

 System.out.println("Please enter an integer : ");

 // Receive user's input and store in an int variable, number.

 int number = input.nextInt();

 // Then, call the isPalindrome() method to check if or not the

 // number is a  palindrome integer.

 // Display the necessary output.

 if (isPalindrome(number)) {

  System.out.println(number + " is a palindrome integer");

 }

 else {

  System.out.println(number + " is a not a palindrome integer");

 }

}

// Method to return the reversal of an integer.

// It receives the integer as a parameter.

public static int reverse(int num) {

 // First convert the number into a string as follows:

 // Concatenate it with an empty quote.

 // Store the result in a String variable, str.

 String str = "" + num;

 // Create and initialize a String variable to hold the reversal of the  

 // string str. i.e rev_str

 String rev_str = "";

 // Create a loop to cycle through each character in the string str,

 // beginning at  the last character down to the first character.

 // At every cycle, append the character to the rev_str variable.

 // At the end of the loop, rev_str will contain the reversed of str

 for (int i = str.length() - 1; i >= 0; i--) {

  rev_str += str.charAt(i);

 }

 // Convert the rev_str to an integer using the Integer.parseInt()

 // method.  Store the result in an integer variable reversed_num.

 int reversed_num = Integer.parseInt(rev_str);

 // Return the reversed_num

 return reversed_num;

}

// Method to check whether or not a number is a palindrome integer.

// It takes in the number as parameter and returns a true or false.

// A number is a palindrome integer if reversing the number does not

//  change the  number itself.

public static boolean isPalindrome(int number) {

 // check if the number is the same as its reversal by calling the

 //reverse()  method declared earlier. Return true if yes, otherwise,

               // return false.

 if (number == reverse(number)) {

  return true;

 }

 return false;

}

}

Explanation:

The source code file for the program has also been attached to this response for readability. Please download the file and go through the comments in the code carefully as it explains every segment of the code.

Hope this helps!

Download java
7 0
2 years ago
Suppose you want to use an Internet cafe to login to your personal account on a bank web site, but you suspect that the computer
kupik [55]

Answer:

Copy and paste the needed information from text editor to clipboard then to the web browser.

Explanation:

The keylogging software is an application that can connect to the keyboard API through software APIs or could be kernel based or hypervisor based, JavaScript based etc, to capture keyboard events.

It records these events which makes this tool useful for attackers in networks. So long as the clipboard logging or screen logging does not accompany the keyboard loggers, data can be copied on clipboard and pasted to the target point.

8 0
3 years ago
How do you destroy data on hard drive?
Nataly_w [17]
You have to destroy the hard drive as it is like a memory for the computer so it can never be deleted
7 0
2 years ago
Read 2 more answers
How can i change ip address <br>​
JulijaS [17]

I believe your answer would be:

1: Open the command prompt window. Do this by clicking the "Start" button, and then selecting "Run." In the window that appears, type "cmd" into the text box and click the "OK" button.

2: Release the computer's current IP address. To do this, type "ipconfig /release" into the command prompt window and press Enter.

3: Acquire a new IP address. Do this by typing "ipconfig /renew" into the command prompt window and pressing Enter. This should assign the computer a new IP address, which will be different from the previous address.

4: Cycle your modem's power. If the above steps don't work, you can try renewing your IP address by cycling your modem's power. Turn off both your computer and your modem (and your router, if you have one). Wait at least 5 minutes, then turn everything back on. If your computer is set to receive an IP address dynamically (the most likely configuration), you should be assigned a new IP address automatically.

5: Check to make sure your IP address has changed. To do this, you can log on to a number of different websites that tell you your IP address.

Hope I helped, if so may I get brainliest and a thanks?

Thank you, Have a good day! =)

7 0
3 years ago
Other questions:
  • Windows enables each user to establish a ____, which identifies to windows the resources, such as apps and storage locations, a
    6·1 answer
  • Ziffcorp, an it firm, uses a technology that automatically updates the antivirus software in all the computers in the firm whene
    13·1 answer
  • The unique physical address burned into every network interface card is its:
    15·1 answer
  • While doing online research you enter this keyword search with a truncation character: man* Which of the following would not be
    15·1 answer
  • If you notice files being transferred to or from your computer a. Simply close the window c. Tell the lab instructor b. Open a n
    11·2 answers
  • The function of while loop is
    14·1 answer
  • I need help with this question. its in the photo
    10·1 answer
  • How is the architecture converted into software code? Elaborate the steps its passes through with help of examples / Diagram.
    15·1 answer
  • 12. In Justify the text is aligned both to the right and to the left margins, adding extra space between words as necessary *
    13·2 answers
  • A eclipse occurs at a full moon when the moon passes between earth and the sun
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!