Assignment 1:- Question 1: Given an integer, , perform the following conditional actions: If is odd, print Weird If is even and in the inclusive range of to , print Not Weird If is even and in the inclusive range of to , print Weird If is even and greater than , print Not Weird. Sample Input 0: 3 Sample Output 0 : Weird Sample Input 1: 24 Sample Output 1: Not Weird Ans: n = int(input("Enter an integer: ")) if n % 2 == 1: print("Weird") elif n % 2 == 0 and 2 <= n <= 5: print("Not Weird") elif n % 2 == 0 and 6 <= n <= 20: print("Weird") elif n % 2 == 0 and n > 20: print("Not Weird") Question 2: Write a Python program to construct the following pattern, using a nested for loop. * * * * * * * * * * * * * * * * * * * * * * * * * Ans: rows = 5 # Upper part of the pattern for i in range(rows): for j in range(i + 1): print("*", end=" ") print() # Lower part of the pattern for i in range(rows - 1, 0, -1): for j in range(i): print("*", end=" ") print() Question 3: Write a Python program that iterates the integers from 1 to 50. For multiples of three print "Fizz" instead of the number and for multiples of five print "Buzz". For numbers that are multiples of three and five, print "FizzBuzz". for i in range(1, 51): # Iterate through numbers from 1 to 50 if i % 3 == 0 and i % 5 == 0: print("FizzBuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i)