0% found this document useful (0 votes)
40 views7 pages

Assign 1

The document contains sample Python code for basic data types, variables, operators, conditional statements, comments, and functions. It defines variables like name, class, div, assigns values and data types, includes if/else statements to check conditions, and prints outputs to demonstrate Python syntax.

Uploaded by

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

Assign 1

The document contains sample Python code for basic data types, variables, operators, conditional statements, comments, and functions. It defines variables like name, class, div, assigns values and data types, includes if/else statements to check conditions, and prints outputs to demonstrate Python syntax.

Uploaded by

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

Name—Deep Chavan

Roll no--20

Batch--S11

ASSIGNMENT1

name="Soham"

Class="SE"

div="S1"

dob="27/10/2004"

roll_no=10

branch="IT"

print(name)

print(Class)

print(div)

print(roll_no)

print(branch)

print(dob)

if 2 < 4:

print("2 is less then 4")


if 7 < 9 :

print("Seven is less than 9")

if 7 < 9 :

print("Seven is less than 9")

if 7 < 9 :

print("Seven is less than 9")

print("Seven is less than 9")

#multiline comment

#written in

#more than just one line

print("Kay bolto bhava")

#multiline string

"""

This is a comment

written in

more than just one line

"""

print("helloooo")

print("---------------------------------------------")

#variables
x=4

print(x)

print(type(x))

x="My name is soham"

print(x)

print(type(x))

x=4.5

print(x)

print(type(x))

print("----------------------------------------------")

#casting

x=str(9)

y=float(9)

z=str(9)

print(x)

print(y)

print(z)

#data type of variable can be known by type()

print("----------------------------------------------")

#String variables can be declared by two ways

x="Soham"

#is same as

x='Soham'
#legal variables defining

Myvar="soham" #pascal case : each word starts with capital letter

my_var="virat" #snake case : each word is separated by an underscore

myVar="modi" #Camel case : each word,execpt the first starts with a capital letter

my1var="python"

print(Myvar)

print(my_var)

print(myVar)

print(my1var)

print("--------------------------------------------")

#multi variables

x,y,z="vk18","lm10","cr07"

print(x)

print(y)

print(z)

print("-----------------------------------------")

x=y=z="soham"

print(x)

print(y)

print(z)

#unpack a collection

fruits=["apple","banana","cherry"]

x,y,z=fruits
print(x)

print(y)

print(z)

print("-----------------------------------------")

OUTPUT

================================= RESTART:
C:/Users/Lab1004/Desktop/Soham10/first.py ================================

Soham

SE

S1

10

IT

27/10/2004

2 is less then 4

Seven is less than 9

Seven is less than 9

Seven is less than 9

Seven is less than 9

Kay bolto bhava

helloooo

---------------------------------------------

4
<class 'int'>

My name is soham

<class 'str'>

4.5

<class 'float'>

----------------------------------------------

9.0

----------------------------------------------

soham

virat

modi

python

--------------------------------------------

vk18

lm10

cr07

-----------------------------------------

soham

soham

soham

apple
banana

cherry

You might also like