AlexVazzz пре 4 година
комит
346ff0e389
1 измењених фајлова са 30 додато и 0 уклоњено
  1. 30 0
      homeworks/fizz_buzz/fizz_buzz_from_file.py

+ 30 - 0
homeworks/fizz_buzz/fizz_buzz_from_file.py

@@ -0,0 +1,30 @@
+from typing import List
+
+#f = open('numbers.txt', 'r')
+#line = f.readline()
+#while line:
+#    print(line)
+#line = f.readline()
+#a = line.split(' ')
+#f.close()
+with open('numbers.txt', 'r') as f:
+    line = f.readline()
+#    for line in f:
+#        print(line, end='')
+a = line.split(' ')
+num1 = int(a[0])
+num2 = int(a[1])
+num3 = int(a[2])
+print(a)
+print(num1)
+print(num2)
+print(num3)
+for i in range(1, num3 + 1):
+    if i % num1 == 0 and i % num2 == 0:
+        print("FB", end = " ")
+    elif i % num1 == 0:
+        print("F", end = " ")
+    elif i % num2 == 0:
+        print("B", end = " ")
+    else:
+        print(i, end = " ")