Python tutorial

In 1991, Guido van Rossum developed Python, a popular computer programming language.

Before you start reading this tutorial, you must read it.

Python first codes 

print (“Welcome to Python Tutorial by”);
print (“Rana Mehtab Alam”);
print (“Lunar Computer College”);
print (123456789)
print (45+55);
print (“This is my first python programme”);

The output of  the programme

Welcome to Python Tutorial by
Rana Mehtab Alam
Lunar Computer College
123456789
100
This is my first python programme
>>>


Reverse Text Order in Python 

#This code is written in python for converting text into reverse order
#As Rana Mehtab Alam in to ( malA batheM anaR )
#Lunar Computer College +92300 4467226
txt = input(“Type text to print in reverse order ?”)

print(“You typed (“,txt,”)”)

text1 = txt[::-1]

print(“Your text in reverse order is (“,text1,”)”)

In this programme (Reverse Text Order) you can convert any input text into reverse text order as shown in the bellow.

OutPut of Programme

Type text to print in reverse order?Rana Mehtab Alam
You typed ( Rana Mehtab Alam )
Your text in reverse order is ( malA batheM anaR )
>>>


Result Card programming in Python with Total Average Grade and Remarks. 

nos = input(“Enter Student name : “)
noc = input(“Enter Class name : “)
it = int(input(“Enter ICS total marks: “))
io = int(input(“Enter ICS obtained marks: “))

wt = int(input(“Enter Windows total marks: “))
wo = int(input(“Enter Windows obtained marks: “))

wwt = int(input(“Enter WinWord total marks: “))
wwo = int(input(“Enter Winword obtained marks: “))

et = int(input(“Enter Excel total marks: “))
eo = int(input(“Enter Excel obtained marks: “))

tt=(it+wt+wwt+et)
to=(io+wo+wwo+eo)
a=(to/tt*100)

if (a>=90):
   g=(“A+”)
elif (a>=80):
    g=(“A”)
elif (a>=70):
    g=(“B”)
elif (a>=60):
    g=(“C”)
elif (a>=50):
    g=(“D”)
elif (a>=33):
    g=(“E”)
elif (a<33):

    g=(“Fail”)

 

print(“Result Card”)
print(“—————————————————-“)
print(“Student Name:”,nos)
print(“Class/Course:”,noc)
print(“—————————————————-“)
print(“ICS: Total Marks:”,it,”Obtained Marks:”,io)
print(“Windows: Total Marks:”,wt,”Obtained Marks:”,wo)
print(“WinWord: Total Marks:”,wwt,”Obtained Marks:”,wwo)
print(“Excel: Total Marks:”,et,”Obtained Marks:”,eo)
print(“—————————————————-“)
print(“Total Subjects Marks:”,tt,”Total Obtained Marks:”,to)
print(“Average:”,a)
print(“Grade:”,g)
print(“—————————————————-“)

Output of Result Card in Python

Enter Student name: Rana
Enter Class name: CCA
Enter ICS total marks: 100
Enter ICS obtained marks:80
Enter Windows total marks: 100
Enter Windows obtained marks:80
Enter WinWord total marks: 75
Enter Winword obtained marks:67
Enter Excel total marks: 75
Enter Excel obtained marks:66
Result Card
—————————————————-
Student Name: Rana
Class/Course : CCA
—————————————————-
ICS: Total Marks: 100 Obtained Marks: 80
Windows: Total Marks: 100 Obtained Marks: 80
WinWord: Total Marks: 75 Obtained Marks: 67
Excel: Total Marks: 75 Obtained Marks: 66
—————————————————-
Total Subjects Marks: 350 Total Obtained Marks: 293
Average: 83.71428571428572
Grade: A
—————————————————-

Prime Number Finding in Python

def is_prime(number):
if number <= 1:
return False
for i in range(2, int(number**0.5) + 1):
if number % i == 0:
return False
return True

# Example usage:
user_number = int(input(“Enter a number: “))
if is_prime(user_number):
print(f”{user_number} is a prime number.”)
else:
print(f”{user_number} is not a prime number.”)

 

Output of Prime Number Programme in Python

Enter a number ? 20

20 in not a prime number

Again Run

Enter a number ? 5

5 is a prime number

>>

 

Python Projects Code Download

For Loop projects download

While Loop projects download


Variable Data Type str int float


Boolean Values


Python Operators download projects and learn All about operators used in Python


Python Array Item list sort add new remove items


How to String Format in Python


How to delete duplicates in Python

listname = [“lunar”, “computer”, “lunar”, “college”, “computer”]
listname = list(dict.fromkeys(listname))
print(listname)

Output

[‘lunar’, ‘computer’, ‘college’]


 

Updating

Thanks for visiting

keep visiting for more projects

Leave a Reply

Your email address will not be published. Required fields are marked *