0% found this document useful (0 votes)
2 views

python-prog1

The document contains several Python programs demonstrating basic string manipulation, finding the largest of three numbers, creating a student mark sheet based on input marks, and implementing functions. Each program includes input prompts and conditional statements to execute specific tasks. The examples illustrate fundamental programming concepts in Python.

Uploaded by

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

python-prog1

The document contains several Python programs demonstrating basic string manipulation, finding the largest of three numbers, creating a student mark sheet based on input marks, and implementing functions. Each program includes input prompts and conditional statements to execute specific tasks. The examples illustrate fundamental programming concepts in Python.

Uploaded by

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

Program to print Python string

Str1 = "Welcome"
Str2 = "Computer Science"
print(str1*3)
print(str1+str2)
print(str1[4])
print(str1[2:4])
Program to print the largest of the three numbers.
a = int(input("Enter a? "));
b = int(input("Enter b? "));
c = int(input("Enter c? "));
if a>b and a>c:
print("a is largest");
if b>a and b>c:
print("b is largest");
if c>a and c>b:
print("c is largest");

Program to create a Students Mark sheet.


marks=int(input("Enter the marks"))
if marks>85 and marks<=100:
print("Congrats ! you scored grade A...")
elif marks>60 and marks<=85:
print("You scored grade B++...")
elif marks>40 and marks<=60:
print("you scored grade B...")
elif marks>30 and marks<=40:
print("you scored grade c...")
else:
print("Sorry you are fail")
Program to implement functions
def print_new():
print("I am a function")
print("My name is print_new")
print_new()

Program to Implementing Functions Without Arguments Using Python


def my_func():
x = 10
print("Value inside function:",x)
x = 20
my_func()
print("Value outside function:",x)

You might also like