Page 384 - Computer Science Class 11 Without Functions
P. 384
Sr. No. Command Output
15 code2.islower() True
16 code1.isalpha() False
17 code9.isalpha() True
18 code4.isdigit() True
19 code5.isdigit() False
20 code1.isalnum() False
21 code4.isalnum() True
22 code5.isalnum() False
23 code6.isalnum() True
24 code1.isspace() False
25 code7.isspace() True
26 code1.startswith('stay') False
27 code2.startswith('stay') True
28 code4.endswith('99') True
29 code5.endswith('9') True
30 code7.endswith(' ') True
31 code7.rfind('s') -1
32 code2.rfind('s') 20
33 code1.index('S') 0
34 code5.index('s') Error
35 code2.replace('stay','Be') 'Be alert and Be safe'
36 code5.replace('9','0') 'Call@000'
37 code6.replace('z','#') 'Call999'
38 code2.split() ['stay', 'alert', 'and', 'stay', 'safe']
39 code2.split('y') ['sta', ' alert and sta', ' safe']
40 code5.split('@') ['Call', '999']
41 code1.partition(' ') ('Stay', ' ', 'Safe')
42 code5.partition('@') ('Call', '@', '999')
43 '*' .join(['stay','safe','and','secure']) 'stay*safe*and*secure'
44 '#'.join([code9,code3]) 'safetyfirst#STAY AWARE'
45 code7.join([code5,code6,code4]) 'Call@999 Call999 999999999'
Unsolved
1. Write a program to accept temperature in Fahrenheit and print the temperature in Celsius. Note: Formula for
conversion
C = (F - 32) * 5 / 9
2. Write a program to accept marks in three subjects and display the percentage of marks. Assume the maximum
marks in each subject is 40.
3. Write a program to accept a number and print its square and cube.
382 Touchpad Computer Science-XI

