July 20, 2023

M.Sc Python Programming Assignment 3

M.Sc Python Programming Assignments Assignment 3 Question: Write a program which will find all such numbers which are divisible by 7 Code: start = int(input(“Enter the starting number: “)) end = int(input(“Enter the ending number: “)) divisible_by_7 = [] for number in range(start, end + 1): if number % 7 == 0: divisible_by_7.append(number) print(“Numbers divisible …

M.Sc Python Programming Assignment 3 Read More »

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 »

Tech Amplifier Final Logo