All Blogs

M.Sc Python Programming Assignment 2

M.Sc Python Programming Assignments Assignment 2 Question: Write a program to check whether the number is even or odd, print out an appropriate message to the user. Code: def check_even_odd(number): if number % 2 == 0: return “even” else: return “odd” number = int(input(“Enter a number: “)) result = check_even_odd(number) message = f”The number {number} …

M.Sc Python Programming Assignment 2 Read More »

M.Sc Python Programming Assignment 1

M.Sc Python Programming Assignments Assignment 1 Question: Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old. Code: import datetime def calculate_year_of_turning_100(age): current_year = datetime.datetime.now().year year_of_turning_100 = current_year + (100 – age) …

M.Sc Python Programming Assignment 1 Read More »

Programming Assignments:TY B.sc(computer application)

TY B.sc(computer application) Control Statements and Loops 1) Write a Python Program to Check if a Number is Positive, Negative or Zero def check_number(num): if num > 0: print(“The number is positive.”) elif num < 0: print(“The number is negative.”) else: print(“The number is zero.”) # Test the program with different numbers check_number(10) # Output: …

Programming Assignments:TY B.sc(computer application) Read More »

Tech Amplifier Final Logo