0

Fizzbuzz

# –≤—Ā–Ķ–ľ, –ī–ĺ–Ī—Ä–ĺ–≥–ĺ –≤—Ä–Ķ–ľ–Ķ–Ĺ–ł —Ā—É—ā–ĺ–ļ) –Ņ–ĺ–ľ–ĺ–≥–ł—ā–Ķ, –Ņ–ĺ–∂–į–Ľ—É–Ļ—Ā—ā–į —Ä–į–∑–ĺ–Ī—Ä–į—ā—Ć—Ā—Ź. –ß—ā–ĺ —Ź —É–Ņ—É—Ā—ā–ł–Ľ? x = 1 while x < 30: if x%3==0: print(str(x) + "fizz") if x%5==0: print(str(x) + "buzz") if x%3==0 and x%5==0: print(str(x) + "fizz buzz") else: print(str(x)) x += 1

15th Feb 2022, 11:05 AM
–†—É—Ā—ā–į–ľ –£—Ā–Ķ–ľ–Ī–į–Ķ–≤
8 Réponses
+ 4
range(1,101,2)
15th Feb 2022, 12:46 PM
Simba
Simba - avatar
+ 2
–≤–ľ–Ķ—Ā—ā–ĺ —ć—ā–ĺ–≥–ĺ –≤—č –ľ–ĺ–∂–Ķ—ā–Ķ –ł—Ā–Ņ–ĺ–Ľ—Ć–∑–ĺ–≤–į—ā—Ć –Ĺ–Ķ—Ā–ļ–ĺ–Ľ—Ć–ļ–ĺ –ĺ–Ņ–Ķ—Ä–į—ā–ĺ—Ä–ĺ–≤ elif. –ö—Ä–ĺ–ľ–Ķ —ā–ĺ–≥–ĺ, –≤—č –ľ–ĺ–∂–Ķ—ā–Ķ –Ĺ–į—á–į—ā—Ć —Ā if x%3==0 and x%5==0: elif....
15th Feb 2022, 12:43 PM
Simba
Simba - avatar
+ 1
for x in range(1,101): if x % 3 == 0 and x % 5 == 0: print("fizzbuzz") elif x % 3 == 0: print("fizz") elif x % 5 == 0: print("buzz") else: print(x)
15th Feb 2022, 12:44 PM
–†—É—Ā—ā–į–ľ –£—Ā–Ķ–ľ–Ī–į–Ķ–≤
+ 1
–Ę—č –≥–Ķ–Ĺ–ł–Ļ) —Ā–Ņ–į—Ā–ł–Ī–ĺ, –Ķ—Č—Ď —Ä–į–∑...
15th Feb 2022, 12:54 PM
–†—É—Ā—ā–į–ľ –£—Ā–Ķ–ľ–Ī–į–Ķ–≤
0
–£–∂–Ķ –ł —ā–į–ļ –Ņ–ĺ–Ņ—Ä–ĺ–Ī–ĺ–≤–į–Ľ, –ł –Ĺ–Ķ –Ņ—Ä–į–≤–ł–Ľ—Ć–Ĺ–ĺ...
15th Feb 2022, 12:44 PM
–†—É—Ā—ā–į–ľ –£—Ā–Ķ–ľ–Ī–į–Ķ–≤
0
–ú–Ĺ–Ķ –Ĺ–į–ī–ĺ —á—ā–ĺ–Ī—č –Ņ—Ä–ĺ–≥—Ä–į–ľ–ľ–į, –Ĺ–Ķ –Ņ–ĺ–ļ–į–∑—č–≤–į–Ľ–į —á–Ķ—ā–Ĺ—č–Ķ —á–ł—Ā–Ľ–į...
15th Feb 2022, 12:45 PM
–†—É—Ā—ā–į–ľ –£—Ā–Ķ–ľ–Ī–į–Ķ–≤
0
–°–Ņ–į—Ā–ł–Ī–ĺ –Ī—Ä–ĺ, —Ā–Ķ–Ļ—á–į—Ā –Ņ–ĺ–Ņ—Ä–ĺ–Ī—É—é...
15th Feb 2022, 12:47 PM
–†—É—Ā—ā–į–ľ –£—Ā–Ķ–ľ–Ī–į–Ķ–≤
0
–†—É—Ā—ā–į–ľ –£—Ā–Ķ–ľ–Ī–į–Ķ–≤ LCM 3 –ł 5 —Ä–į–≤–Ĺ–ĺ 15, –Ņ–ĺ—ć—ā–ĺ–ľ—É –ī–ĺ—Ā—ā–į—ā–ĺ—á–Ĺ–ĺ —ā–ĺ–Ľ—Ć–ļ–ĺ –ĺ–ī–Ĺ–ĺ–≥–ĺ —É—Ā–Ľ–ĺ–≤–ł—Ź, —ā–ĺ –Ķ—Ā—ā—Ć x%15.
15th Feb 2022, 2:10 PM
Sanjay Kamath
Sanjay Kamath - avatar