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

CS Codes

The document contains a collection of Python code snippets that demonstrate various programming concepts such as conditional statements, loops, arithmetic operations, and user input handling. It includes examples for checking leap years, calculating areas, handling Armstrong numbers, and performing basic arithmetic operations. The code snippets are commented out and cover a wide range of topics for educational purposes.
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)
14 views

CS Codes

The document contains a collection of Python code snippets that demonstrate various programming concepts such as conditional statements, loops, arithmetic operations, and user input handling. It includes examples for checking leap years, calculating areas, handling Armstrong numbers, and performing basic arithmetic operations. The code snippets are commented out and cover a wide range of topics for educational purposes.
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/ 61

# '''

# year=int(input("EWnter the year"))

# if (year%4)==0:

# print("It is a leap year")

# else:

# print("It is not a leap year")

# x,y=20,60

# y,x,y=x,y-10,x+10

# print(x,y)

# x=40

# y=x+1

# x=20,y+x

# print(x,y)

# a=30

# b=a+b

# print(a,b)

# name="Rehmamn"

# age=89

# print("Your a and age ", a and age)


# a=3

# s=a+10

# a="new"

# q=a/10

# '''

# '''

# a=int(input("Enter first no-"))

# b=int(input("Enter second no-"))

# c=int(input("Enter third no-"))

# x=a**2

# y=b**2

# z=c**2

# if x+y==z:

# print("It is a right angle triangle")

# elif y+z==x:

# print("It is a right angle triangle")

# elif z+x==y:

# print("It is a right angle triangle")

# else:

# print("Wrong values")

# '''

# '''

# #WAP to take 2 digits no and print reverse of it.


# a=int(input("Enter a"))

# b=a%10

# c=a//10

# d=b*10+c

# print(d)

# '''

# '''

# a=int(input("Enter a-"))

# x=a%10

# y=a//10

# z=y%10

# p=y//10

# print(x*100+z*10+p)

# '''

# '''

# for i in range (1,5):

# for j in range(i):

# print(i,"",end="")

# print()

# '''

# '''

# n=3

# s=2

# print(' '*n,'*')
# for i in range(1,4):

# for sp in range(2,i-1,-1):

# print(" ",end='')

# for st in range(1):

# print('* '+' '*s+'*',end="")

# s=s+2

# print()

# print()

# '''

# '''

# for i in range(1,11):

# if i==9:

# break

# else:

# print(i)

# '''

# '''

# n=int(input("enter int"))

# if n>0:

# for a in range(1,n+n):

# print(a/(n/2))

# else:

# print("now quitting")

# '''
# '''

# n=11

# for i in range(2,5):

# if n%i!=0:

# print("Phython output question")

# continue

# else:

# print("bye")

# '''

# '''

# for i in range(5):

# if i%2==0:

# break

# else:

# print(i)

# '''

# '''

# n=int(input("Enter n"))

# f=1

# while n>0:

# f=f*n

# n-=1

# print(f)

# '''

# '''
# count=0

# while count<10:

# print("Hello")

# count+=1

# '''

# '''

# x=10

# y=0

# while x>y:

# print(x,y)

# x=x-1

# y=y+1

# '''

# '''

# keepgoing=True

# x=100

# while keepgoing:

# print(x)

# x=x-10

# if x<50:

# keepgoing=False

# '''

# '''

# x=45
# while x<50:

# print(x)

# '''

# '''

# for x in range(5):

# print(x)

# '''

# '''

# for p in range(1,10):

# print(p)

# '''

# '''

# for q in range(100,50,-10):

# print(q)

# '''

# '''

# x=10

# y=5

# for i in range(x-y*2):

# print(" % ",i)

# '''

# '''

# for q in range(100,50,-10):

# print(q)

# '''
# '''

# for z in range(-500,500,100):

# print(z)

# '''

# '''

# for y in range(500,100,-100):

# print(" * ",y)

# '''

# '''

# x=10

# y=5

# for i in range(x-y*2):

# print(" % ",i)

# '''

# '''

# for x in range(3):

# for y in range(4):

# print(x,y,x+y)

# '''

# '''

# c=0

# for x in range(10):

# for y in range(5):
# c+=1

# print(c)

# '''

# '''

# while True:

# a=int(input("Enter a-"))

# b=int(input("Enter b-"))

# print("Enter 1 for add")

# print("Enter 2 for sub")

# print("Enter 3 for mul")

# print("Enter 4 for div")

# #print("Enter 5 for exit")

# choice=int(input("Enter ur choice"))

# if choice==1:

# print(a+b)

# elif choice==2:

# print(a-b)

# elif choice==3:

# print(a*b)

# elif choice==4:

# print(a/b)

# co=input("Do u wanna continue?")

# if co=='no':

# break
# '''

# '''

# a=int(input("Enter a-"))

# sum=0

# temp=a

# while a>0:

# rem=a%10

# sum=sum+rem**3

# a=a//10

# if temp==sum:

# print("It is an Armstrong number")

# else:

# print("It is not an Armstrong number")

# '''

# '''

# a=int(input("Enter a-"))

# sum=0

# while a>0:

# sum=sum+a

# a=int(input("Enter a-"))

# print(sum)

# '''

# '''

# n=int(input("Enter n-"))

# no=1
# even_sum=0

# odd_sum=0

# while no<=n:

# if no%2==0:

# even_sum=even_sum+no

# else:

# odd_sum=odd_sum+no

# no=no+1

# print(even_sum)

# print(odd_sum)

# ''''''

# a,b=2,3

# print (a+3)

# '''

# '''

# if a>0:

# print("no is positive")

# else:

# print("no is negative")

# '''

# '''

# no1=int(input("Enter lenght"))

# no2=int(input("Enter breadth"))

# c=no1*no2

# print("area of reactangle ---->",c)


# '''

# '''

# print("mango\b trees")

# '''

# '''

# print("\x4D")

# '''

# '''

# x=1

# y=2

# z=3

# print(x,y,z,sep="<")

# '''

# '''

# x=10.9

# print(int(x))

# '''

# '''

# a=2

# b=3

# print(a!=b)

# '''

# '''

# a=2

# b=4
# a*=3

# print(a)

# '''

# '''

# p=int(input("Enter Principle Amount"))

# r=12.5

# t=15

# si=(p*t*r)/100

# print("Simple Intrest ---->",si)

# '''

# '''

# a=2

# b=4

# a,b=b,a

# print(a,b)

# '''

# '''

# a=int(input("Enter KiloMeter"))

# c=a*1000

# print("Value in Meters ----->",c)

# '''

# '''

# import random

# a=random.randrange(2,6)

# print(a)
# '''

# '''

# a=int(input("Enter number"))

# if a/2==0:

# print("number is divisible by 2")

# else:

# print("number is not divisible ny 2")

# '''

# '''

# no1=int(input("Enter First Number"))

# no2=int(input("Enter Second Number"))

# if no1==no2:

# print("They are Equal")

# else:

# print("They are Unequal")

# '''

# '''

# no1=int(input("Enter First Number"))

# no2=int(input("Enter Second Number"))

# if no1>no2:

# print("Yes First Number is greater than the Second Number")

# else:

# print("NO First Number is not greater than the Second Number")

# '''

# '''
# x=(input("Enter any Character"))

# if x=='a' or x=='e' or x=='i' or x=='o' or x=='u':

# print("Character is a Vowel")

# else:

# print("Character is a Consonent")

# '''

# '''

# x=int(input("Enter Age"))

# if x>=18:

# print("You are elejable to vote")

# else:

# print("You are not elejable to vote")

# '''

# '''

# print("Press 1 for calculating the area of circle")

# print("Press 2 for calculating the perimeter of circle")

# choise=int(input("Enter your choise"))

# radius=int(input("Enter radius"))

# if choise==1:

# area=3.14*radius*radius

# print("Area of circle is",area)

# else:

# perimeter=2*3.14*radius

# print("Perimeter of circle is",perimeter)

# '''
# '''

# x=int(input("Enter sells amount"))

# if x>=1000:

# discount=(10/100)*x

# print("Your Discount is",discount)

# else:

# discount=(5/100)*x

# print("Your Discount is",discount)

# '''

# '''

# a=(input("Enter a Character"))

# if a=='A' or a=='a':

# print("It is a Vowel")

# elif a=='E' or a=='e':

# print("It is a Vowel")

# elif a=='I' or a=='i':

# print("It is a Vowel")

# elif a=='O' or a=='o':

# print("It is a Vowel")

# elif a=='U' or a=='u':

# print("It is a Vowel")

# else:

# print("It is a Consonent")

# '''

# '''
# no1=int(input("Enter First Number"))

# no2=int(input("Enter Second Number"))

# a=input("Enter a Character")

# if a=='+':

# c=no1+no2

# print("Solution",c)

# elif a=='-':

# c=no1-no2

# print("Solution",c)

# elif a=='*':

# c=no1*no2

# print("Solution",c)

# elif a=='/':

# c=no1/no2

# print("Solution",c)

# '''

# '''

# a=int(input("Enter your percentage"))

# if a>=90:

# print("You have got Grade A")

# elif a>=80:

# print("You have got Grade B")

# elif a>=60:

# print("You have got Grade c")

# elif a>=33:
# print("You have Failed")

# '''

# '''

# a=int(input("Enter First Number"))

# b=int(input("Enter Second Number"))

# c=int(input("Enter Third Number"))

# if a>b and a>c:

# print("a is the Biggest Number")

# elif b>a and b>c:

# print("b is the Biggest Number")

# elif c>a and c>b:

# print("c is the Biggest Number")

# '''

# '''

# print("Press 1 for Calculating amount of Battery Based Toys")

# print("Press 2 for Calculating amount of Key Based Toys")

# print("Press 3 for Calculating amount of Electrical Charged Based Toys")

# choise=int(input("Enter your choise"))

# x=int(input("Enter Amount"))

# if choise==1:

# if x>1000:

# Amount=x-((10/100)*x)

# print("You have to Pay Rs",Amount)

# elif choise==2:

# if x>100:
# Amount=x-((5/100)*x)

# print("You have to Pay Rs",Amount)

# elif choise==3:

# if x>500:

# Amount=x-((10/100)*x)

# print("You have to Pay Rs",Amount)

# '''

# '''

# a=int(input("Enter Unit Reading"))

# if a>0 and a<100:

# c=a*0.5

# print("You have to pay Rs",c)

# elif a>101 and a<200:

# c=(a-100)*1

# print("You have to pay Rs",c)

# elif a>201 and a<300:

# c=(a-200)*1.5

# print("You have to pay Rs",c)

# elif a>300:

# c=(a-300)*2

# print("You have to pay Rs",c)

# '''

# '''

# x=int(input("Enter Distance"))

# if x>=1 and x<50:


# c=x*8

# elif x>=50 and x<100:

# c=x*10

# elif x>=100:

# c=x*12

# print("You have to pay Rs",c)

# '''

# '''

# print("Press sh for Calculating amount of Short")

# print("Press p for Calculating amount of Pants")

# print("Press st for Calculating amount of Shirts/T-Shirts")

# choise=(input("Enter your choise"))

# x=int(input("Enter Amount"))

# if choise=='sh':

# if x>0 and x<=100:

# c=x-((0/100)*x)

# print("You have to pay Rs",c)

# elif x>100 and x<=200:

# c=x-((5/100)*x)

# print("You have to pay Rs",c)

# elif x>200 and x<=300:

# c=x-((10/100)*x)

# print("You have to pay Rs",c)

# elif x>300:

# c=x-((18/100)*x)
# print("You have to pay Rs",c)

# if choise=='p':

# if x>0 and x<=100:

# c=x-((3/100)*x)

# print("You have to pay Rs",c)

# elif x>100 and x<=200:

# c=x-((8/100)*x)

# print("You have to pay Rs",c)

# elif x>200 and x<=300:

# c=x-((12/100)*x)

# print("You have to pay Rs",c)

# elif x>300:

# c=x-((20/100)*x)

# print("You have to pay Rs",c)

# if choise=='sht':

# if x>0 and x<=100:

# c=x-((5/100)*x)

# print("You have to pay Rs",c)

# elif x>100 and x<=200:

# c=x-((10/100)*x)

# print("You have to pay Rs",c)

# elif x>200 and x<=300:

# c=x-((15/100)*x)

# print("You have to pay Rs",c)

# elif x>300:
# c=x-((22/100)*x)

# print("You have to pay Rs",c)

# '''

# '''

# x=int(input("Enter Year"))

# if x%4==0:

# print("It is a leap year")

# else:

# print("It is not a leap year")

# '''

# '''

# a=int(input("Enter Perpendicular"))

# b=int(input("Enter Base"))

# c=int(input("Enter Hypotenous"))

# if (a**2)+(b**2)==(c**2):

# print("Yes, these sides can form a Right-Angled Triangle")

# else:

# print("No, these sides cannot form a Right-Angled Triangle")

# '''

# '''

# a=int(input("Enter First Number"))

# b=int(input("Enter Second Number"))

# c=int(input("Enter Third Number"))

# d=int(input("Enter Forth Number"))

# k=int(input("Enter k"))
# x=int(input("Enter Variable"))

# if x>k:

# f=(a*(x**3))-(b*(x**2))+(c*x)-d

# print("The Value of f is",f)

# elif x==k:

# f=0

# print("The Value of f is",f)

# elif x<k:

# f=(a*(x**3))+(b*(x**2))-(c*x)+d

# print("The Value of f is",f)

# '''

# '''

# a=int(input("Enter Seconds"))

# b=a//60

# c=a%60

# print(c,'min and',b,'seconds')

# '''

# '''

# for i in range(1,11):

# print(i)

# '''

# '''

# for i in "abcde":

# print(i)

# '''
# '''

# for i in range(10,1,-2):

# print(i)

# '''

# '''

# sum=0

# for i in range(1,11):

# sum=sum+i

# print(sum)

# '''

# '''

# b=int(input("Enter Number"))

# num=b

# for i in range(1,11):

# print(num,'x',i,'=',num*i)

# '''

# '''

# n=int(input("Enter the Number"))

# f=0

# s=1

# print(s)

# print(f)

# for i in range(n+1):

# t=f+s

# print(t)
# f,s=s,t

# '''

# '''

# n=int(input("Enter the Number"))

# f=1

# for i in range(n,0,-1):

# f=f*i

# print(f)

# '''

# '''

# for i in range(-25,0,5):

# print(i," " ,end=" ")

# '''

# '''

# for i in range(1,4):

# print(i)

# for j in range(1,3):

# print(j," " ,end=" ")

# print()

# '''

# '''

# for i in range(1,5,1):

# for j in range(i):

# print("*",end="")

# print()
# for i in range(1,5):

# for j in range(i):

# print(i,end="")

# print()

# for i in range(1,5):

# for j in range(i):

# print(j+1,end="")

# print()

# for i in range(1,6):

# for j in range(i):

# print(j,end="")

# print()

# for i in range(1,5):

# for space in range(4,i,-1):

# print(" ",end="")

# for star in range(i):

# print("* ",end=" ")


# print()

# for i in range(1,5):

# for space in range(4,i,-1):

# print(" ",end="")

# for star in range(i):

# print("* ",end="")

# print()

for i in range(1,6):

for space in range(5,i,-1):

print(" ",end=" ")

for star in range(i):

print(" * ",end=" ")

print()

for i in range(1,6):

for space in range(i):

print(" ",end=" ")

for star in range(5,i,-1):

print(" * ",end=" ")

print()

#
# for i in range(1,5):

# A=65

# for j in range(i):

# print(chr(A),end="")

# A=A+1

# print()

# l=[1,2,3,4,5,6,7]

# print(l[3])

# '''

# '''

# L=[1,2,3,4,5,]

# L.append(6)

# print(L)

# '''

# '''

# l=[13,18,11,16,13,18,13]

# l.append(l.count(13))

# print(l)

# '''

# '''

# a=[1,2,3]

# b=['A','B','C']

# b.extend(a)
# print(b)

# '''

# '''

# a=[1,2,3]

# b=['a','b','v']

# print(a.index(1))

# '''

# '''

# a=[1,2,3,4,5,]

# print(a.pop(2))

# print(a)

# '''

# '''

# a=[1,2,3,4,5]

# a.remove(5)

# print(a)

# '''

# '''

# a=[1,2,3,4,6,7,8,9,]

# print(len(a))

# '''

# '''

# a=[1,2,3,4,6,7,8,9,]

# a.insert(2,'hello')

# print(a)
# '''

# '''

# a=[1,2,3,4,6,7,8,9,]

# a.reverse()

# print(a)

# '''

# '''

# a=[1,2,3,4,6,7,8,9,]

# a.sort(reverse=False)

# print(a)

# '''

# '''

# a=['apple','ball','cat','dog','egg']

# a.sort(reverse=True)

# print(a)

# '''

# '''

# a=[1,2,3,4,4,4,4,5,6]

# print(a.count(0))

# '''

# '''

# a=[1,2,3,4,4,4,4,5,6]

# a1=['a','b','c']

# a=a1.copy()

# print(a1)
# '''

# '''

# a=eval(input("Enter"))

# print(type(a))

# '''

# '''

# a=eval(input("Enter-"))

# a[-1]=3

# print(a)

# '''

# '''

# a=[1,2,3,4,5,6,7]

# a[2:5]=67,9,43

# print(a)

# '''

# ''''

# a=[1,2,3,4,5,6,7]

# del a[4]

# print(a)

# '''

# '''

# a=[1,2,3,4,5,6,7]

# print(10000*a)

# '''

# '''
# a=[1,2,3,4,5,6,7,8,9,10]

# for i in range(len(a)):

# print(a[i],end=" ")

# '''

# '''

# a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]

# b=[]

# c=[]

# for i in range(len(a)):

# if a[i]%2:

# b.append(a[i]/2)

# else:

# c.append(a[i]*2)

# print(b,c)

# '''

# '''

# a=[1,2,3,4]

# b=[]

# c=[]

# for i in range(len(a)):

# if a[i]>0:

# b.append(a[i]**2)

# print(b)

# for i in range(len(a)):
# if a[i]>0:

# c.append(a[i]**3)

# print(c)

# '''

# '''

# a=int(input("enter a-"))

# if a**2%10==a%10:

# print("ITS AUTOMORPHIC")

# else:

# print("ITS NOT AUTOMORPHIC")

# '''

# '''

# a=eval(input("Enter list"))

# c=0

# for elem in a:

# if elem[0] in 'Tt':

# c=c+1

# print(elem)

# print("There are",c,"elements which start with t")

# '''

# '''

# a=[23,45,6,28]

# for i in a:
# sum=0

# for j in range(1,i):

# if i%j==0:

# sum=sum+j

# if sum==i:

# print(i,"its perfect")

# else:

# print(i,"its not perfect")

# '''

# '''

# M=[1,5,9]

# L=[3,1,4]

# N=[]

# for i in range(3):

# print(M[i]+L[i])

# '''

# '''

# A=[1,4,2,5,0,0,5,0,5]

# A.sort(reverse=False)

# print(A)

# '''

# '''

# l1,l2=[2,4] , [2,4]
# l3=l2

# l2[1]=5

# print(l3)

# '''

# '''

# l1,l2=[2,4] , [2,4]

# l3=list(l2)

# l2[1]=5

# print(l3)

# '''

# '''

# a=[1]

# b=[1]

# print(a==b)

# print(a is b)

# '''

# '''

# l=[3,2,4,5,6,3,2,55,3]

# print(l[: :-1])

# '''

# #STRING
# '''

# s='hello'

# for i in s:

# if i in 'aeiou' or i in 'AEIOU':

# s=s.replace(i, '*')

# print(s)

# '''

# '''

# s='abc'

# print(s[::-1])

# '''

# '''

# s='hello world'

# a=s.split()

# print(a)

# d=""

# for i in a:

# b=i[::-1]

# d=d+b

# print(d)

# '''

# '''

# s='sumeet'

# k=''

# for i in range (len(s)):


# if i%2!=0:

# k=k+s[i].upper()

# else:

# k=k+s[i]

# print(k)

# '''

# '''

# s='0123456789'

# a=s.split()

# k=''

# for i in a:

# b=i[0:11:3]

# k=k+b

# '''

# """

# s=input("Enter any sentence:")

# a=s.split()

# for i in a:

# j=i.capitalize()

# print(j,end=" ")

# """

# '''

# s=input("Enter string:")

# sum=0

# k=''
# for i in s:

# if i.isdigit():

# sum=sum+int(i)

# k=k+i

# if s.isalpha():

# print(s,'has no digits')

# print(s,sum)

# '''

# '''

# s='reverse'

# print(s)

# for i in range(len(s)):

# s=s[:-1]

# print(s)

# '''

# '''

# a='abcd'

# b=a.startswith()

# print(b)

# a='abcd'

# b=a.endswith()

# print(b)
# a='abcd efgh'

# b=a.title()

# print(b)

# '''

# '''

# a='abcd'

# b='#'.join('abcd')

# print(b)

# '''

# '''

# print('#'.join(['helli','ewrwa']))

# '''

# '''

# x='is is cs class'

# y=x.partition('is')

# print(y)

# '''

# '''

# l=[5,48,6,6415]

# b=l.reverse()

# print(b)

# '''
# '''

# l=[32,452,17]

# b=sorted(l,reverse=True)

# print(b)

# l=[32,452,17]

# b=sorted(l,reverse=False)

# print(b)

# '''

# '''

# s=input('test')

# rs=''

# for ch in s:

# rs=ch+rs

# print(rs+s)

# '''

# '''

# s='abc'

# rs=''

# for ch in s:

# rs=ch+rs

# print(rs+s)

# '''
#

# a=input("Enter a sentence:")

# b=" "

# for i in a:

# if i.isupper():

# b=b+i.lower()

# elif i.islower():

# b=b+i.upper()

# print(b)

# a=input("Enter any string-")

# b=a.split()

# c=''

# for i in range(len(a)):

# c=c+a[i]

# print(c)

# a=input("Enter any string-")

# b=int(input("enter n value-"))

# print(a[-b:])
# '''

# a=input("enter two words")

# c=a.split()

# print(c)

# for word in c:

# for letter in word:

# if letter=='a':

# print(word)

# '''

# a=input("enter line-")

# b=input("enter substring")

# print(a)

# d=a.count(b)

# print(d)

# TUPLES

# a='hello'

# print(tuple(a))

# a=(23,45,75)
# b=(43,65,234)

# print(a+b)

# a=(23,45,75)

# b=print(list(a))

# print(b)

# a=(11,2,2,3)

# k=[]

# for i in a:

# k.append(i)

# print(k)

# a=input("enter roll-")

# b=input("enter name-")

# c=input("enter marks-")

# # T=(a,b,c)

# # print(T)

# e=[]

# for i in a,b,c:

# e.append(i)

# print(e)

# f=print(tuple(e))

# choice='yes'
# while choice=='yes' or choice=='YES':

# a=input("enter roll-")

# b=input("enter name-")

# c=input("enter marks-")

# e=[]

# g=()

# for i in a,b,c:

# e.append(i)

# print(e)

# f=print(tuple(e))

# a=(2,4,3)

# b=a*2

# print(b)

# a=(15,11,17,16,12)

# a.pop(12)

# print(a)

# a=(15,21,23,5,)

# b=a+a

# print(b)

# a=()

# b=a*2

# print(len(b))
# a=(5)

# b=a*2

# print(len(b))

# a=(5,)

# b=a*2

# print(len(b))

# a=(5,3,1,9,0)

# print(a[:-2])

# a=(10,20,30,40,50,60,70)

# print(a[5:-1])

# a,b,c,d,e=(p,q,r,s,t)=(1,2,3)

# tuple=('a','b','c','d','e')

# tuple=('A',)+tuple[1:]

# print(tuple)

# a=(3,4)

# b=('3','4')

# print(a+b)

# k=(1,2,3,4,5,6,)

# a=k[:]

# print(a)

# T=("These",["are","a","few","words"],"that","we","will","use"

# b=T[2][2] in T[1]
# print(b)

# a=(4,5,6)

# b=(6,7)

# print(b-a)

# k=()

# sum=0

# for i in range(5):

# a=input("enter marks for 1st sub-")

# b=input("enter marks for 2nd sub-")

# c=input("enter marks for 3rd sub-")

# T=(a,b,c)

# k=k+(T,)

# print(k)

# b=k.list()

# print(b)
# DICTIONARIES

# D={'name':'sumeet','age':'15','class':'11A'}

# D['age']=17

# print(D['class'])

# d=dict(Name="Sumeeet",Age=22)

# print(d)

# D=dict({1:'A',2:'B',3:'C'})

# print(D)

# d=dict(zip(('phy','che','mat'),(25,45,60)))

# print(d)

# D=dict([['phy',65],['chem',55],['mat',50]])

# print(D)

#ITTERATION

# D=dict({1:'A',2:'B',3:'C'})

# for key in D:

# print(key,D[key])
# d={'name':'sumeet','age':'17','rollno':'30'}

# d['address']='vashi'

# print(d)

# d={}

# for i in range(3):

# rollno=input("enter roll:")

# name=input("enter name:")

# d[rollno]=name

# print(d)

# D=dict({1:'A',2:'B',3:'C'})

# print(len(D))

# D=dict({1:'A',2:'B',3:'C'})

# print(D.items())

# D=dict({1:'A',2:'B',3:'C'})

# print(D.get(2))

# D=dict({1:'A',2:'B',3:'C'})
# print(D.values())

# D=dict.fromkeys([3,4,5],76)

# print(D)

# D=dict({1:'A',2:'B',3:'C'})

# D.setdefault(2,2300)

# print(D)

i=3

k=1

while i<4:

print(k*'*',end='')

print()

if k==3:

break

else:

k+=1

i=-1

You might also like