100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Basics of Python & String - Revision $5.49   Add to cart

Class notes

Basics of Python & String - Revision

 3 views  0 purchase
  • Course
  • Institution

The document has the summary basics of strings used in the python programming language , a complete revision before exam.

Preview 1 out of 2  pages

  • November 4, 2021
  • 2
  • 2021/2022
  • Class notes
  • James
  • All classes
avatar-seller
Basics of Python / String Manipulation – Revision 3
1. Evaluate the following expression:
a) 26//4//7
b) 2**2**3
c) (20 + 10)*15/5

d) 2+9*((3*12)-8)/10
e) 10 + 6 * 2 ** 2 != 9//4 -3 and 29>= 29/9




f) 5 % 10 + 10 < 50 and 29 <= 29
g) (0 < 6) or (not (10 == 6) and (10<0))


h) 5 % 10 + 10 < 50 and 29//7 <= 29%7


2. Guess the correct output of the following code?

a)
str1 = "Examination"
print(str1[1:4], str1[:5], str1[4:], str1[::-1])
print(str1[::-2],str1[-5:-7],str1[-5:-1])

b) Str1 = "EXAM2020"
Str2 = ""
I=0
while I<len(Str1):
if Str1[I]>="A" and Str1[I]<="M":
Str2=Str2+Str1[I+1]
elif Str1[I]>="0" and Str1[I]<="9":
Str2=Str2+ (Str1[I-1])
else:
Str2=Str2+"*"
I=I+1
print(Str2)

3. Write Python programs for the following:
1. Read a string from the user and count words beginning with A/a and ending with T/t.
2. Read a string from the user and display words that does not contain alphabet E/e.
3. Read a string from the user and count alphanumeric characters.
4. Read a string from the user and extract all the digits from the string and display it a
single number and also find the sum of all the digits present in the string.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Stevendurby. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $5.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

72841 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$5.49
  • (0)
  Add to cart