atlas news
    
Python Programs XI
18  octobre     13h14
Python Program to input any character and print box of that
   nbsp;x input ’Enter the charcater: ’ nbsp;r int input ’Enter the no. of rows: ’ nbsp;c int input ’Enter the no. of columns: ’ nbsp;print x c nbsp;ns x ’ ’ c x nbsp;for i in range r : nbsp; nbsp; nbsp; print ns nbsp;print x c
22  septembre     12h14
Python Program to print star( ) rhombus of side length 3.
   n j n print ’ ’ n ’ ’ for i in range, n : nbsp; nbsp; if i gt;n: nbsp; nbsp; nbsp; nbsp; print ’ ’ i n ’ ’ ’ ’ j ’ ’ nbsp; nbsp; else: nbsp; nbsp; nbsp; nbsp; print ’ ’ n i ’ ’ ’ ’ i ’ ’ if n gt; : nbsp; nbsp; print ’ ’ n ’ ’
    05h48
Python program to calculate the area of a trapezoid.
   nbsp;height float input Height of trapezoid: base float input ’Base one value: ’ base float input ’Base two value: ’ area base base heightprint Area is: , area
    05h33
Python program to convert radian to degree
   pi radian float input Input radians: degree radian pi print degree
21  septembre     04h52
Python program to convert degree to radian.
   nbsp;pi degree float input Input degrees: radian degree pi print radian
14  septembre     16h08
Python Program to print a kajukatri shape
   n spc n for row in range,n : x ’’ x ’ ’ spc for col in range,row : x x str col ’ ’ for col in range row, , : x x str col ’ ’ print x spc spc spc...
12  septembre     17h09
Python Program to input and string and print total number of characters in that (without len()) # working of len() function
   str input ’Enter String’ c str list str while str : nbsp; nbsp; nbsp;c nbsp; nbsp; nbsp;str.pop print c
    17h05
Python Program to print all permutations using those three variables a,b,c 0,0,0. Output : 000,001,...... 999
   for i in range : nbsp; nbsp; nbsp;for j in range : nbsp; nbsp; nbsp; nbsp; nbsp;for k in range : nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; x str i str j str k nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; print x
    16h35
Python Program to input any sentence and sub-string print the index of given sub-string if found else print -1
   nbsp;mainstring input ’Enter any sentence : ’ tofind input ’Enter any word to find : ’ l len tofind temp False for i in range len mainstring l : twochar mainstring i:i l if twochar tofind: print ’Found at index : ’,i ...
    16h23
Python Program to input a string and check whether it is palindrome or not
   original input ’Enter Any Number : ’ reverse original :: if original reverse: nbsp;print ’The number you entered is a palindrome number ’ else: nbsp;print ’The number you entered is not a palindrome number ’
    16h09
Python Program to input any number and print a star triangle
   num int input ’Enter any value : ’ for i in range num : nbsp; nbsp;print ’ ’ i
11  septembre     19h04
Python Program to input any sentence and reverse it word by word
   sen input ’enter sentence’ r sen.split ’ ’ x ’ ’for i in r: nbsp; nbsp; x i :: ’ ’print x nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp;
05  septembre     17h16
PythonProgram to input decimal number and print binary of the number
   x ’’n int input ’Enter any n’ while n gt; : nbsp; rem n nbsp; n n nbsp; x x str rem print x ::
03  septembre     17h09
Python Program to print the reverse order of string
   str input Enter word s str.reverseprint s
02  septembre     16h29
Python Program to Input 3 variable’s value and print the biggest variable
   nbsp;x int input ’Enter x’ y int input ’Enter y’ z int input ’Enter z’ if x gt; y and x gt; z : print x, ’ is greatest’ elif y gt; z and y gt; z : print y, ’ is greatest’ else : ...
    16h28
Python Program to Input no. of persons ,sales amt.amt. Find commission of that person based on given condition sales amt. comm
   gt; ’’’ no int input ’Enter person number’ sa int input ’Enter sales amt’ com if sa gt; and sa lt; : com . sa elif ...
28  août     19h06
Python Program to input any sentence and create a dictionary with consonant and vowels.
   name input ’Enter Any Sent. ’ v cnt c cnt oth cnt vowels ’aeiou’for i in name : if i.isalpha : if i in vowels : v cnt else ...
    19h01
Python program to combine two dictionary adding values for common keys
   nbsp;d ’a’: , ’b’: , ’c’: d ’a’: , ’b’: , ’d’: nbsp;d dict for i in d : nbsp; nbsp; if i in d : nbsp; nbsp; nbsp; nbsp; d i d i d i nbsp; nbsp; else: nbsp; nbsp; nbsp; nbsp; d.update d nbsp; nbsp; nbsp; nbsp; d.update d print d
    18h58
Python script to generate and print a dictionary that contains a number (between 1 and n) in the form (number, square of number)
   n int input ’Enter Any number ’ nbsp;d dict for i in range,n : nbsp; nbsp; print d.update i:i i
    18h55
Python script to concatenate following dictionaries to create a new one.
   dic :, : nbsp;dic :, : dic :, : dic .update dic dic .update dic d dic print d
    18h50
Python Program that reads a string and display it in reverse order.
   Str input ’enter any string’ l len str a str :: print ’ original string ’,Str print ’ reversed string ’,a nbsp;
24  août     19h02
Python Program to input any string and substring and search for substring and print the occurrence of substring in main string if it is there
   nbsp; To understand find or search and index functionstr input ’Enter any sentence: ’ str str.lower print str ch input ’Enter character to be found: ’ occ int input ’Enter occurance of character to be found: ’ c str.count ch if occ gt;c : print ’Not Found’ else...
    18h54
Python Program to input any string and differenciat vowels and consonants
   nbsp;sen input ’Enter a sentence.. ’ a ’ ’b ’ ’for i in sen: nbsp; if i in ’aeiou’: nbsp; nbsp; a a i nbsp; elif i ’ ’: nbsp; nbsp; continue nbsp; else: nbsp; nbsp; b b iprint ’vowels ’,a,’consonants ’,b
    18h50
Python Program to input any string and print words starts with consonant and vowels inthe different list
   str input ’Enter any sentence’ str ’ ’ns ’’vo word conso word for ch in str: if ch ’ ’ : c ns if c in ’AEIOUaeiou’ : vo word.append ns else...
    18h37
Python Program to input any number(N) and print sum of 1 to N.
   n int input ’Enter Any Number ’ sum for i in range,n : nbsp; nbsp; sum sum iprint sum