TORONTO KIDS COMPUTER CLUB | Aurora Saturday 16:30 Python Homework 21.05.15.
19446
post-template-default,single,single-post,postid-19446,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

Aurora Saturday 16:30 Python Homework 21.05.15.

18 May Aurora Saturday 16:30 Python Homework 21.05.15.

Question:
Create a loop between 1 to 20.

  • Print “fizz” if the number is divisible by 3
  • Print “bizz” if the number is divisible by 5
  • Print “fizzbizz” if a number is divisible by both 3 and 5.
  • Otherwise, print the number itself.

Hint:
You could use % operator (find the division remainder) to check if the number is divisible by another number, such as: 14 % 7 the result would be 0, that means 14 is divisible by 7 or 14 is the multiples of 7.

No Comments

Sorry, the comment form is closed at this time.