Fundamentals
Numbers
Data Types
Integers
def converter(number): if number == 0: return "zero" elif number == 1: return "one" elif number == 2: return "two" elif number == 3: return "three" elif number == 4: return "four" elif number == 5: return "five" elif number == 6: return "six" elif number == 7: return "seven" elif number == 8: return "eight" elif number == 9: return "nine" return number
- def converter(number):
- if number == 0:
- return "zero"
- elif number == 1:
- return "one"
- elif number == 2:
- return "two"
- elif number == 3:
- return "three"
- elif number == 4:
- return "four"
- elif number == 5:
- return "five"
- elif number == 6:
- return "six"
- elif number == 7:
- return "seven"
- elif number == 8:
- return "eight"
- elif number == 9:
- return "nine"
- return number
public class FizzBuzz { public string GetOutput(int number) { if (number % 3 == 0 && number % 5 == 0) return "FizzBuzz"; if (number % 3 == 0) return "Fizz"; if (number % 5 == 0) return "Buzz"; return number.ToString(); } }
- public class FizzBuzz
- {
- public string GetOutput(int number)
- {
- if (number % 3 == 0 && number % 5 == 0)
{- return "FizzBuzz";
}- if (number % 3 == 0)
{return "Fizz";}- return "Fizz";
- if (number % 5 == 0)
{- return "Buzz";
}- return number.ToString();
- }
- }