Download as pdf
Download as pdf
You are on page 1of 6
Python: Loop a = Cg ene pESCIIPTION Complete the DecimalToUinay funetlon with appropriaecode to seco an integer Inthe range 10 999 and dlsplay the binary equivalent ofthat number as output Following requirements shoul be taken caren the program. Input should be takonthroush Console Program should prin the output as described lathe Example Section below ithe numbers essthan 1 or greater than 999 then the output should show as INVALID. INPUT Uze While loop tosolve the above problem. Sample Input 1: ‘Solution code b ea [ein Score: 100 pots) Submision: 20120 cove wer outPur Pythond ¥ @ RUNCOBE = VERIFY 6 def decittebinorynn hs fencon comers deci maber ii (ranean ee else ? )aranecbingnny (21) muntnecegut0) ecinatTetnarynn) © 2revsonefoundtor tesla, © stowsevisions Hello there! a cacy SOpcins DESCRIPTION Problem Statement. ‘Take input from standard input into variable e.gname then print Hell, ", Input Format The oly ine ofthe input will contain astringepresenting aname. Output Format Print astring “Hello, " Evaluation Parameters Sample Input Sample Output EXECUTION TIME LIMIT conv wr Solution code GACCEPTED] Score: 50 points (details) 8 cone nru.—outpur Python3 ¥ © RUNCoDE 1 2 3 mane nput() rane Het, + ne) 5 © teeision ound this soation - © cans Sop DESCRIPTION. Problem Statement ‘Writea program that reads two strings from theinput The strings havetobe concatenated with aspace between them. Input Format + Therewillbetwe sing on twoseparatelnes Constraints + 1 <-lenathofeschstring Output Format + Printa single string by concatenating the two strings with single space between them. Evaluation Parameters Sample input 1 1D Solutioncode Score: SOpeints st) coor pur outrur Python3 + © muNcooe TD # Read the variable fron STON 3 a= pare) 4 b= upg © primey = VERIFY Positive Negative Catng SOpelns DESCRIPTION Problem Statement ‘Writea program to add two numbers and then print positiveif the ‘sumispositive(sum>=0) else print negative the sumis negativelsum<0), Input Format + There willbe twornumbers A and B separated by newline. Constraints + O<= [AL IB1<= 100, Output Format + Print positive" itsum of those numbers is postive, + Print "negative" if sum of those numbersis negative, Evaluation Parameters Input 1 Solutioncode Score: SOpoints sete) cove pur. output 2-H Read the vortable fron STOIN 3 a = tatctrpue() 4 b= uecurputg) S sm ob 6 AF (aurm-0) 7 pranec"postetve") eee 9 printc“negative') Pythons + (© puncove 1 Sottioncode ree, Pepe ome sine srt oo eine DescRIPTION (CREME) Seore: SO points tn) Q Problem Statement coos mut ovreur Python3 ¥ © fUNCODE = VERIFY ‘Write program that takes an integer anda character Cand prints string Ncharacterslong, consisting only of Cs Fer erample.i(N = Sandand CW shouldreturn the tring Yon" 4 ead the vata fron STON (without quotes) 3s neenpet(> 4c tet 5 tut = mc (Python's unusual that you can actually write an exoressionS thatwilleveuate to nos Forte sake ofthe exerciceyoushould peat ienore thatthe problemcanbesoWved inthis manner) E i Input Format + Firstlne witcontainaninteges N + Thesecon line willontainastrng, © Output Format + Print car CN tes Evaluation Parameters Prime Parameters a coding 100, DESCRIPTION ‘Write function isPrimel) which takes a number num as parameter ‘and prints PRIME'f the parameters prime number else returns ‘COMPOSITE. Acertainranga has been st within which aum should fal the parameters outside the sven range the function should print Outof Range. Input Format + Thefirst ine contains the numberof test cases. + Thenext Tlnes contain ninteger number num, whichisto be chheckediitisapimernumber, composite number ofits eut cofrange. Constraints + tet e100 + 2<=mum<= 1000 ‘Output Format + Htmumis rime then print PRIME. else print COMPOSITE + Hfmumisoutof the gvenrange print Out of Range Solatloncode (PHEEEMD) Score: 100points san) VY cose eaten sucent ef seria hh = 1090, hg» tre AF un < tod orm > bags | petneoue oF Range"y | foe «an rage.nay 2) 11 Age rae 1) tes a 11 prwecrntey prim ‘comostte) T= wecsepetor ret) far tn rage sr appenasat(eeit0)) tran Pythons. ~

You might also like