Sort by

recency

|

4475 Discussions

|

  • + 0 comments

    omgggg test3 and test7 were failing because I was using the & operator instead of and #yesimajavavictim

  • + 0 comments

    !/bin/python3

    import math import os import random import re import sys

    if name == 'main': n = int(input().strip())

    if n % 2 == 1 : print("Weird")

    elif (n>=2 and n<=5): print("Not Weird")

    elif (n >=6 and n<=20): print("Weird")

    else: print("Not Weird")

  • + 0 comments

    here is the code :

    if n % 2 !=0: print("Weird") elif n % 2 ==0 and 220: print("Not Weird")

  • + 0 comments
    def _check_even(n):
        if n%2 != 0:
            return False
        else:
            return True
    
    if not _check_even(n):
        print('Weird')
    elif _check_even(n) and n in range(1, 6):
        print('Not Weird')
    elif _check_even(n) and n > 20:
        print('Not Weird')
    elif _check_even(n) and n in range(5, 21):
        print('Weird')
    
  • + 0 comments

    This code works because - there are two outputs 'Weird' and 'Not Weird'. If we notice closely the cases when it should be 'Weird' we see two conditions n should be odd or in range 6 to 20. we can combine these conditions via OR statement and rese of the cases will be 'Not Weird' if(n%2 != 0 or (n>=6 and n<=20)): print('Weird') else: print('Not Weird')