0

Output counter

How to make a line counter which counts how many outputs it has given? Also, if you like the code please like! https://sololearn.com/compiler-playground/cv703yy8w8Pn/?ref=app

23rd Jan 2024, 9:51 PM
Emptynew Account
Emptynew Account - avatar
1 Antwort
0
def find_prime_factors(number): global counter_line_prime_number, counter_all_line_call division = 2 factors = [] while division <= number: counter_all_line_call += 1 if number % division == 0: counter_line_prime_number += 1 factors.append(division) number = number // division else: division = division + 1 if len(factors) == 1: print(factors) try: your_range = int(input())+1 except: print("Manual: type a Number, this generator generates prime numbers between 0 and your number") exit() counter_line_prime_number, counter_all_line_call = 0, 0 for x in range(2, your_range): number_range = x find_prime_factors(number_range) print(f"All count line prime number is {counter_line_prime_number}.") print(f"All count call line is {counter_all_line_call}.")
25th Jan 2024, 12:22 PM
Kunevich Evgeniyy Evgenievich
Kunevich Evgeniyy Evgenievich - avatar