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

Nterms Int (Input (Enter Num) )

Programs
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Nterms Int (Input (Enter Num) )

Programs
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

nterms=int(input("enter num:"))

n1,n2=0,1
count=0
if nterms<=0:
print("enter pos num")
elif nterms>=1:
print("fibo series upto",nterms)
print(n1)
else:
print(fibonacci sequence)
while count<nterms:
print(n1)
n=n1+n2
n1=n2
n2=n
count+=1

celsius=float(input(enter a temp:\n))
f=(1.8*celsius)+32
print("temp in f",f)
if f>32:
print("beloew f")
else:
print("above")

def toh(n,source,destination,auxiliary)
if n==1:
print("move from disk 1",source,"to destination",destination)
return
toh(n-1,source,auxiliary,destination)
print("move disk",n,"from source",source,"to destination",destination)
toh(n-1,auxiliary,destination,source)
n=3/n=int(input(enter the num))
toh(n,'a','b','c')

import re
frequenc={}
document_text=open(test.txt,'r')
text_string=document_text.read().lower()
match pattern=re.findall(r'\b[a-z]{1,15}\b',text_string)
for word in match pattern
count=frequency.get(word,0)
frequency(word)=count++1
frequency_list=frequency.keys()
for words in frequency_list
print(words,frequency(words))

test list=['correction','stion','frequency','ion','ststion']
print("the original list is"+str(test list))
subs='tion'
res=0
for i in test list:
if i.find(subs)!=-1:
res+=1
printf("all the strings count with given subssttrinf are"+str(res))

class BinaryTreeNode:
def__init__(self,data):
self.data=data
self.leftchild=none
self.rightchild=none

node1= BinaryTreeNode(80)
node2= BinaryTreeNode(67)
node3= BinaryTreeNode(56)
node4= BinaryTreeNode(12)
node5= BinaryTreeNode(89)
node6= BinaryTreeNode(56)
node7= BinaryTreeNode(34)

node1.rightchild=node2
node1.leftchild=node3
node2.rightchild=node4
node2.leftchild=node5
node3.rightchild=node6
node3.leftchild=node7

print("root node is")


print(node1.data)

print("leftnode is")
print(node1.leftchild.data)

print("right node is")


print(node1.rightchild.data)

print("root node is")


print(node2data)

print("leftnode is")
print(node2.leftchild.data)

print("right node is")


print(node2. rightchild.data)
print("root node is")
print(node3.data)

print("leftnode is")
print(node3.leftchild.data)

print("right node is")


print(node3rightchild.data)
print("root node is")
print(node4.data)

print("leftnode is")
print(node4.leftchild)

print("right node is")


print(node4.rightchild)
print("root node is")
print(node5.data)

print("leftnode is")
print(node5.leftchild)

print("right node is")


print(node5.rightchild)
print("root node is")
print(node6.data)

print("leftnode is")
print(node6.leftnode)

print("right node is")


print(node6.rightchild)
print("root node is")
print(node7.data)

print("leftnode is")
print( node7.leftchild.data)

print("right node is")


print(node7.rightchild.data)

#global variable{
i=0
def monkey_g0_box(x,y):
global i
i=i+1
print('step',i,'monkey slave',x,'go to',+y)

def monkey_move_box(x,y):
global i
i=i+1
print('step',i,'monkey take the box from',x,'delivery to',+y)

def monkey_g0_box():
global i
i=i+1
print('step',i,'monkey climbs up the box')
def monkey_g0_box():
global i
i=i+1
print('step',i,'monkey picked a banana')
}

codeIn=sys.stdin.read()
codeInlist= codeIn.split()
monkey=
banana =
box=
print("the steps are as follows")

You might also like