You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.2 KiB
58 lines
1.2 KiB
3 years ago
|
#!/bin/python
|
||
|
# 1 bis 20
|
||
|
# fizz durch 3 teilbar
|
||
|
# buzz durch 5 teilbar
|
||
|
# durch 3 und 5 teilbar fizzbuzz
|
||
|
|
||
|
# for z in range(1, 101):
|
||
|
# if z % 3 == 0:
|
||
|
# print("Fizz", end="")
|
||
|
# if z % 5 == 0:
|
||
|
# print("Buzz", end="")
|
||
|
# if z % 3 != 0 and z % 5 != 0:
|
||
|
# print(z, end="")
|
||
|
# print()
|
||
|
|
||
|
|
||
|
|
||
|
# 3 -> Fizz
|
||
|
# 5 -> Buzz
|
||
|
# 13 -> Penis
|
||
|
|
||
|
def eval_dividers(user_inputs, num):
|
||
|
divisible = False
|
||
|
for curr in user_inputs:
|
||
|
div = curr[0]
|
||
|
word = curr[1]
|
||
|
|
||
|
if num % div == 0:
|
||
|
print(word, end="")
|
||
|
divisible = True
|
||
|
|
||
|
return divisible
|
||
|
|
||
|
|
||
|
def print_loop(user_inputs, max_number):
|
||
|
for i in range(1, max_number + 1):
|
||
|
if not eval_dividers(user_inputs, i):
|
||
|
print(i)
|
||
|
else:
|
||
|
print()
|
||
|
|
||
|
|
||
|
def init():
|
||
|
# (1, "Ass")
|
||
|
user_input = input("Bitte Zahl und Wort eingeben: ").split(" ")
|
||
|
user_inputs = []
|
||
|
# user_input = int(input("Test: "))
|
||
|
while len(user_input) > 1:
|
||
|
user_input[0] = int(user_input[0])
|
||
|
user_inputs.append(user_input)
|
||
|
user_input = input("Bitte Zahl und Wort eingeben: ").split(" ")
|
||
|
|
||
|
max_number = int(input("Bitte obere Grenze angeben: "))
|
||
|
print_loop(user_inputs, max_number)
|
||
|
|
||
|
|
||
|
init()
|