Question

python 3 please, for these questions you do not need to write the whole code just...

python 3 please, for these questions you do not need to write the whole code just the expression

1)Write a loop that reads positive integers from standard input, printing out those values that are greater than 100, each on a separate line, The loop terminates when it reads an integer that is not positive.

2) Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out, on a line by itself, the sum of all the even integers read.

3)Write a loop that displays all possible combinations of two letters where the letters are 'a', or 'b', or 'c', or 'd', or 'e'. The combinations should be displayed in ascending alphabetical order:

aa
ab
ac
ad
ae
ba
bb
...
ee

0 0
Add a comment Improve this question Transcribed image text
Answer #1

while True:
    n = int(input())
    if n > 100:
        print(n)
    elif n <= 0:
        break

total = 0
while True:
    n = int(input())
    if n <= 0:
        break
    if n % 2 == 0:
        total += n
print(total)

for ch1 in "abcde":
    for ch2 in "abcde":
        print(ch1+ch2)

Add a comment
Know the answer?
Add Answer to:
python 3 please, for these questions you do not need to write the whole code just...
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
  • Python My ITlab: 1. Write some code that repeatedly reads a value into the variable n...

    Python My ITlab: 1. Write some code that repeatedly reads a value into the variable n until a number between 1 and 10 (inclusive) has been entered. 2. Write some code that repeatedly reads a value from standard input into the variable response until at last a Y or y or N or n has been entered. 3.Write a loop that reads positive integers from standard input, printing out those values that are greater than 100, each on a separate...

  • Please use Python to solve this problem: Write a loop that reads positive integers from standard...

    Please use Python to solve this problem: Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out, on a single line and separated by a single space, the sum of all the even integers read and the sum of all the odd integers read.

  • C++ Write a loop that reads positive integers from standard input and that terminates when it...

    C++ Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out the sum of all the even integers read and the sum of all the odd integers read(The two sums are separated by a space). Declare any variables that are needed.

  • 1) Translate the following equation into a Python assignment statement 2) Write Python code that prints...

    1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...

  • Written in PYTHON for MyProLab please :) There is no more information. this is all the...

    Written in PYTHON for MyProLab please :) There is no more information. this is all the questions asks. Write a definition of a function named copy that reads all of the lines that remain in standard input and displays them in standard output, one on a line with no other spacing. The function must not use a loop of any kind.

  • 9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array. Demonstrate the function by using it in the main program that reads an integer N  (that is not more than 50) from standard input and then reads N  integers from a file named...

  • Written in python programming for MyProLab :) Please use simple code Assume the availability of a...

    Written in python programming for MyProLab :) Please use simple code Assume the availability of a function called printStars. The function receives an integer value as an argument. If the argument is positive, the function prints (to standard output) the given number of asterisks. Thus, if printStars(8) is called, ******** (8 asterisks) will be printed. Assume further that the variable starCount has been declared and initialized with an integer value, possibly negative or zero. Write some code that does nothing...

  • Need help writing four short recursive programs: Write a program called Permutations.java that takes an integer...

    Need help writing four short recursive programs: Write a program called Permutations.java that takes an integer command-line argument, n, and enumerates all permutations of the first n letters in the English alphabet. Be sure to handle exceptions of the types: i) bad user input (i.e., double, string), ii) n > 26 or n < 0. Write a program called PermutationsK.java that takes two integers, n and k, as command-line arguments and prints out all P(n,k) permutations that contain exactly k...

  • python language Primes Write a program primes.py that reads a positive integer from standard input, and...

    python language Primes Write a program primes.py that reads a positive integer from standard input, and determines whether or not the number is prime A prime number is a positive integer that is greater than 1, an e can be divided exactly (without leaving a rerm or itself 1 $ python3 primes. py 2 one positive integer please: 21 3 21 is not prime! 5 S python3 primes. py 6 one positive integer please 7 23 is prime

  • (C++) Write a function that accepts an int array and the array’s size as arguments. The function...

    (C++)Write a function that accepts an int array and the array’s size as arguments.The function should create a new array that is twice the size of the argument array.The function should copy the contents of the argument array to the new array, and initialize the unused elements of the second array with 0.The function should return a pointer to the new array.Demonstrate the function by using it in a main program that reads an integer N (that is not more...

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
ADVERTISEMENT