******************************************************************************************
Q.)
‘pneumonoultramicroscopicsilicovolcanoconiosis’ is the longest word in a dictionary with 45 letters. Given the value of ‘i' and the value of ‘k' write an algorithm and the subsequent Python code to output the five letters of the above longest string which are in the positions that are the first five multiples of 2*i+k. If a multiple is greater than the length of the string, then continue the counting from the beginning of the string. For example, if the value of i = 5 and k = 2 then the output letters are ‘r’, ‘c’, ‘n’, ‘e’, and ‘i'. The longest string is stored in a variable named as 's' in the precode, to be used for coding.
Input:
Read the value of 'i'
Read the velue of 'k'
Read the value of 'i'
Read the velue of 'k'
Output:
Print the letters in the position that are the first five multiples of '2*i + k' , one letter in one line
Code:Print the letters in the position that are the first five multiples of '2*i + k' , one letter in one line
s="pneumonoultramicroscopicsilicovolcanoconiosis"
i=int(input())
k=int(input())
p=2*i+k
i=1
while(i<6):
if(p*i-1>45):
s=s+s
print(s[p*i-1])
i=i+1
Procedure:
while(i<6):
if(p*i-1>45):
s=s+s
print(s[p*i-1])
i=i+1
Pseudo-Code:
1) let s = "pneumonoultramicroscopicsilicovolcanoconiosis" - the longest word
2) Read 'i' as an integer input
3) Read 'k' as an integer input
4) let p = 2*i + k
5) let i=1
6) while 'i' is less then 6, repeat step 7
7) if p*i - 1 > 45, repeat steps (8,9,10)
8) s = s + s - double the word
9) print(s[p*i - 1])
10) i = i + 1
2) Read 'i' as an integer input
3) Read 'k' as an integer input
4) let p = 2*i + k
5) let i=1
6) while 'i' is less then 6, repeat step 7
7) if p*i - 1 > 45, repeat steps (8,9,10)
8) s = s + s - double the word
9) print(s[p*i - 1])
10) i = i + 1
******************************************************************************************
plss upload the algorithm also
ReplyDeleteAlgorithm updated.
Deleteplease upload pps4
ReplyDeleteThe solutions are updated. Do check out.
Deletehttps://myskillrack.blogspot.in/2017/08/pps-4.html
print(s[p*i - 1])
ReplyDeletei cant understand this step.
Assume some example by yourself and try to understand, You will get it.
DeletePankaj Sir Skillcopy has stopped working. Do something about it
ReplyDeleteI'm really sorry. I can't help in this matter.
DeleteBro plz upload solution of inlab 5
ReplyDelete