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

Kothrud Lecture 1 Tuesday

The document contains a series of Python code snippets demonstrating basic programming concepts such as printing, variable assignment, data types, arithmetic operations, and string manipulation. It also includes comments explaining the purpose of certain lines and common errors encountered in coding. Overall, it serves as a beginner's guide to coding in Python.

Uploaded by

xaszjsksas
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)
6 views

Kothrud Lecture 1 Tuesday

The document contains a series of Python code snippets demonstrating basic programming concepts such as printing, variable assignment, data types, arithmetic operations, and string manipulation. It also includes comments explaining the purpose of certain lines and common errors encountered in coding. Overall, it serves as a beginner's guide to coding in Python.

Uploaded by

xaszjsksas
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/ 9

"""

print("i love you")

print('i love you')

print("this is my first coding class")

print("22222")

print("x")

print("2+2")

print("my friend karthikeya")

#print(x) error

# use for comments and it is only for users not for computer

print("this is my first coding class")

"""

"""

#print(x)

print("xxxx")

print("x,y,z,w")

print("x+y+z+w")

print("98796872536578626938")

print("1+2")

"""

"""

#variable

int variable

x=5

y=22

u=123

variable usually alocate memory in computer

float variable decimal

x=2.2
y=1.0

u=9.99

string variable sentence

x="my name is goldy"

y="my name"

z="1234"

king=2 #int

king_kong=5 #variable name cant have space

mango1=10 #int

2mongo=20 #variable name never start with number

print=10 # print cant be a name of variable

my_name_is_king="hero" #string

"""

w="2+2"

"""

x=20

y=20.20

z="this is me"

print(x) #20

print("x") #x

print(x,y) #20 20.20

print(x+y) #40.20

print(z) #thia is me

print(z+z) #thia is methia is me

print(z,z,z,z,z) #thia is me thia is me thia is me thia is me thia is me

print(z+z+z+z+z) #thia is methia is methia is methia is methia is me

print(2x) #error he will search for 2x variable

print(2x+2y) #error
print(xx) #error

x=3

y=4

z=x+y+5

print(x,y,z) #3,4,12

w="i love my nation"

m="i dont like pakistan"

print(w+" "+m) #i love my nation i dont like pakistan

print(w,x,y,z,m) #i love my nation 3 4 12 i dont like pakistan

print('x,y,z') #x,y,z

print('x+y+z') #x+y+z

x=4

y=5

x=x+y

print(x,y) #9 5

y=x+y

print(x,y) #9 14

"""

"""

x=3

y=4

z=x+y

print(x+y+z) #14

print(x*2) #6 * multiplication
print(x*2+y*2+z*3) #35

print(x*y*z) #84

print(x**2+y**2) #25 ** power

print(x+y*2+z**3-y**2+x) #341

print(x***2) #error

print(z/x) #/ division

print(z//x) #//floor division quotient

print(z%x) #% modulus remainder

print("x"+"y"+"z")

"""

#print("this is my first lecture of coding \ni am loving it") #\n break the sentence

"""

x=2.1

y=3.12

z=y-x

print(x,y,z)

print("x\ny\nz")

print(x,"\n",y,"\n",z)

"""

"""

**

***

****

*****

print("*\n**\n***\n****\n*****")

"""

"""

total_mangoes=5
print(total_mangoes)

mangoes1=5

mangoes2=10

print(mangoes1+mangoes2)

print(mangoes1*mangoes2)

print(mangoes2-mangoes1)

print(mangoes1-mangoes2)

apple1=4

apple2=3

fruits=apple1+apple2

print(fruits+fruits)

total_fruit_with_me=apple1+apple2+mangoes1+mangoes2

print(total_fruit_with_me)

"""

"""

fruit_type="citrus fruit" #string

no_of_fruits=10 #

print("fruit_type")

print(fruit_type)

print("no_of_fruits")

print(no_of_fruits)

print("fruit_type and no_of_fruits")

print(fruit_type,no_of_fruits)
print(fruit_type and no_of_fruits)

print(no_of_fruits and fruit_type)

print(fruit_type+no_of_fruits)

we can not add string to int and float

x=3 #int

y="lol" #string

print(x+y) #we cant add string and int

"""

#conversion of string,int,float

"""

a=10 #int

b=10.5 #float

c=str(a) # str converts a value into string

print(a+b) #a is int b is float

print(b+c) # b is float and c is string

print(b,c)

print(a,c)

d=str(b) #string

print(c+d) #1010.5

print(c,d) #10 10.5

print(a+b,c+d) #20.5 1010.5

e=int(c) #int converts a value into int

f=float(d) #float converts a value into float

print(e+f) #20.5

print(a,b,c,d,e,f)
print(a+b,c+d,e+f)

print(a+b,c,d,e+f)

"""

"""

y="my desh india" #my desh india has no integral value

x=int("my desh india")

print(x)

x=int("15")

print(x)

"""

"""

fruit_type="citrus fruit"

no_of_fruits=10

print(fruit_type+str(no_of_fruits))

"""

"""

y=("fruit_type"+"\n")*5

print(y)

z=("fruit_type"+" ")*5

print(z)

lol="hello"

x=(lol+"\n")*5+(lol+" ")*5

print(x)
"""

#comparison opr boolean data type it always return true or false

"""

< less thn

> greater thn

<= less thn equal

>=greater thn equal

== equal

!= not equal

"""

"""

x=10

y=20

print(x>y)

print(x<y)

print(x>=y)

print(x<=y)

print(x==y)

print(x!=y)

print("x"<"y")

print("my name is rohit"=="rohit is my name")

print("my name is rohit"!="rohit is my name")

print("10"!="20")

"""

"""

hello

hello
hello hello

hello

hello

hello hello

using only one print command

"""

lol="hello"

x=(lol+"\n")*2+(lol+ " ")*2

y=(lol+"\n")*2+(lol+ " ")*2

print(x+"\n"+y)

print("Hello\nHello\nHello Hello\nHello\nHello\nHello Hello")

You might also like