0% found this document useful (0 votes)
7 views3 pages

Debug

The document contains a series of Python code snippets and their corresponding outputs. It demonstrates string manipulation, concatenation, and error handling, including TypeErrors and NameErrors. The output shows results for various operations, including counting characters, modifying strings, and handling invalid operations.

Uploaded by

malarravee01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Debug

The document contains a series of Python code snippets and their corresponding outputs. It demonstrates string manipulation, concatenation, and error handling, including TypeErrors and NameErrors. The output shows results for various operations, including counting characters, modifying strings, and handling invalid operations.

Uploaded by

malarravee01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

DEBUG /RECORD THE OUTPUT

1) a="abc"

b=a.count(chr(98))

c=a.index(chr(98))

d=a.find(chr(100))

e=a.count(chr(97))

print(a)

print(b)

print(c)

print(d)

print(e)

2) print("abc"+"123")

3) print("abc"+"abc")

4) print("abc"*2)

5) print("abc"*-2)

6) print("abc"*2.2)

7) print("abc"*5)

8) a="*"

b=’ ’

for i in range(5):

a+=b

print(a)

9) a=input("Enter any string")

b=input("Enter any string")

print("The first string",a)


print("The second string",b)

if a in b:

c=b[0:4]+"train"

print("Modified string is",c)

10)print(12+”12”)

OUTPUT

1) abc

-1

2) abc123
3) abcabc
4) abcabc
5) no output(empty space)
6) TypeError: can't multiply sequence by non-int of type 'float'

7) abcabcabcabcabc

8) *

9)a) Enter any stringin

Enter any stringin

The first string in

The second string in

Modified string is intrain


Enter any stringrin

b) Enter any stringtin

The first string rin

The second string tin

NameError: name 'c' is not defined

10) TypeError: unsupported operand type(s) for +: 'int' and 'str'

You might also like