Muqnit Ur Rehman - Assignment - 1
Muqnit Ur Rehman - Assignment - 1
Assignment 01
Fall 2023 PF (due: 09-10-23)
Roll No: BSDSF23wxyz
Name: MUQNIT UR REHMAN
Compiler:
Developers can build programs in high-level languages that are
understandable by people, but compilers can translate such high-level
languages into machine-readable code.
C++, Rust, and other compiled languages are examples.
Interpreter:
Instead of creating a separate executable file, an interpreter interprets and
runs the program line by line or statement by statement. It reads a statement
from the source code, converts it to machine code, runs that statement, and
then moves on to the next statement. This procedure keeps on till the software
is finished.
`
return
print(n)
print_counting(n - 1)
print_counting(1000)
• Write a program that interactively get a positive integer from user and if that
number is even number it prints True otherwise prints False.
Z = int(input("Enter a positive integer: "))
if Z < 0:
("Input must be a positive integer.")
if Z % 2 == 0:
print("True")
else:
print("False")
• Write a program that interactively get user’s last name and then first name
and later print them in correct order (i.e., first_name last_name) on one line.
X= input("Enter your first name: ")
Y = input("Enter your last name: ")
Z= (X+Y)
print("Full name:", Z)
`
Nice, give half of above total as charity, and give my side back to me
Given? __ [enter yes or y]
Thanks, bye
• Search (Google) for PYTHON sample programs for absolute beginners, select
about 5 from them, interpret them in Mu Editor (or somehow) and submit
their code (sequence of instruction).
No1:
print("I am micke")
No2:
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
result = num1 + num2
print("The sum is:", result)
No3:
text = input("Enter a sentence: ")
uppercase_text = text.upper()
print("Uppercase:", uppercase_text)
No4:
fahrenheit = float(input("Enter the temperature in Fahrenheit: "))
celsius = (fahrenheit - 32) * 5/9
print("The temperature in Celsius is:", celsius)
No5:
num = int(input("Enter a number: "))
if num % 2 == 0:
print(f"{num} is an even number.")
else:
print(f"{num} is an odd number.")