Skip to main content
added more tags and improved the title
Link
t3chb0t
  • 44.7k
  • 9
  • 85
  • 191

Studying python. Print some elements from input

added 20 characters in body
Source Link

I am studying Python, so it is very easy task. I want to get best and most elegant way to solve each simple task. The task is: Write a program that reads the integers from the console one number per line. For each entered number check:

  1. if the number is less than 10, skip that number;

  2. if the number is greater than 100, stop to read the numbers; Print all numbers that does not satisfy those two conditions.

    lst = [] num = 0 while num <=100: num = int(input()) if num > 100: break if num >= 10: lst.append(num)

    print('\n'.join(str(value) for value in lst))

Write a program that reads the integers from the console one number per line. For each entered number check:

  1. if the number is less than 10, skip that number;
  2. if the number is greater than 100, stop to read the numbers;

Print all numbers that does not satisfy those two conditions.

lst = []
num = 0
while num <=100:
    num = int(input())
    if num > 100:
        break
    if num >= 10:
        lst.append(num)

print('\n'.join(str(value) for value in lst))

I am studying Python, so it is very easy task. I want to get best and most elegant way to solve each simple task. The task is: Write a program that reads the integers from the console one number per line. For each entered number check:

  1. if the number is less than 10, skip that number;

  2. if the number is greater than 100, stop to read the numbers; Print all numbers that does not satisfy those two conditions.

    lst = [] num = 0 while num <=100: num = int(input()) if num > 100: break if num >= 10: lst.append(num)

    print('\n'.join(str(value) for value in lst))

I am studying Python, so it is very easy task. I want to get best and most elegant way to solve each simple task. The task is:

Write a program that reads the integers from the console one number per line. For each entered number check:

  1. if the number is less than 10, skip that number;
  2. if the number is greater than 100, stop to read the numbers;

Print all numbers that does not satisfy those two conditions.

lst = []
num = 0
while num <=100:
    num = int(input())
    if num > 100:
        break
    if num >= 10:
        lst.append(num)

print('\n'.join(str(value) for value in lst))
Source Link

Studying python. Print some elements from input

I am studying Python, so it is very easy task. I want to get best and most elegant way to solve each simple task. The task is: Write a program that reads the integers from the console one number per line. For each entered number check:

  1. if the number is less than 10, skip that number;

  2. if the number is greater than 100, stop to read the numbers; Print all numbers that does not satisfy those two conditions.

    lst = [] num = 0 while num <=100: num = int(input()) if num > 100: break if num >= 10: lst.append(num)

    print('\n'.join(str(value) for value in lst))