[go: up one dir, main page]

0% found this document useful (0 votes)
58 views2 pages

FAWAZ (Roll No # 72 (Evening) - Jupyter Notebook

Uploaded by

faisalsalhyhyat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

FAWAZ (Roll No # 72 (Evening) - Jupyter Notebook

Uploaded by

faisalsalhyhyat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

9/8/24, 4:58 AM FAWAZ ( Roll no # 72( Evening) - Jupyter Notebook

In [1]: print("HAMZA AKHTAR")


HAMZA AKHTAR

In [2]: i=("HAMZA")
for z in range (1,10):
print(i);
print(z);

HAMZA
1
HAMZA
2
HAMZA
3
HAMZA
4
HAMZA
5
HAMZA
6
HAMZA
7
HAMZA
8
HAMZA
9

In [3]: count = 0
while count < 10 :
print ("count:", count)
count +=1

count: 0
count: 1
count: 2
count: 3
count: 4
count: 5
count: 6
count: 7
count: 8
count: 9

In [4]: number = int(input("Enter a number: "))


if number % 2 == 0:
print(number, "is even.")
else:
print(number, "is odd.")

Enter a number: 12
12 is even.

localhost:8898/notebooks/FAWAZ ( Roll no %23 72( Evening).ipynb 1/2


9/8/24, 4:58 AM FAWAZ ( Roll no # 72( Evening) - Jupyter Notebook

In [7]: a = 10
b = 5
addition = a + b
subtraction = a - b
multiplication = a * b
division = a / b

print(f"Addition: {a} + {b} = {addition}")
print(f"Subtraction: {a} - {b} = {subtraction}")
print(f"Multiplication: {a} * {b} = {multiplication}")
print(f"Division: {a} / {b} = {division}")

Addition: 10 + 5 = 15
Subtraction: 10 - 5 = 5
Multiplication: 10 * 5 = 50
Division: 10 / 5 = 2.0

In [6]: number = float(input("Enter a number: "))


if number > 0:
print("The number is positive.")
elif number < 0:
print("The number is negative.")
else:
print("The number is zero.")

Enter a number: 20
The number is positive.

In [9]: n = 10

squares = [i**2 for i in range(1, n + 1)]
print("List of squares from 1 to", n, ":", squares)

List of squares from 1 to 10 : [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

In [14]: def factorial(n):


if n == 0:
return 1
else:
return n * factorial(n - 1)
num = 10
print(f"Factorial of {num} is {factorial(num)}")

Factorial of 10 is 3628800

In [ ]: ​

localhost:8898/notebooks/FAWAZ ( Roll no %23 72( Evening).ipynb 2/2

You might also like