python means

Python Strings,Text and Printing

Despite having experience developing Python strings, you are still unsure of their function. To help you understand what these variables are for, we’ve created a ton of them with intricate strings for this exercise. Python strings are first described.

What is Python Strings?

A python strings is typically some text that you want to “export” from the program you are building or display to someone. Python understands that you want something to be a string when you surround it with either ” (double-quotes) or'(single-quotes). When you use print and place the text you want to go to the string inside of ” or’after the print, you have probably seen this a lot. Python then outputs it.

The format characters you have discovered so far may be found in python strings. The formatted variables are simply added to the string, followed by the percent sign (%) and the variable. The only exception is that you must place your formats inside of () parentheses and separate them with commas if you want your string to output multiple variables using different formats. It’s like you told me what you wanted from the supermarket and said, “I want milk, eggs, bread, and soup.” Only in programming do we say, “(milk, eggs, bread, soup).”

We will now type in a whole bunch of strings, variables, and formats, and print them. You will also practice using short abbreviated variable names. Python Programmers love saving themselves time at your expense by using annoying cryptic variable names, so let’s get you started being able to read and write them early on.

x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
y = "Those who know %s and those who %s." % (binary, do_not)

print x
print y

print "I said: %r." % x
print "I also said: '%s'." % y

hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"

print joke_evaluation % hilarious

w = "This is the left side of..."
e = "a string with a right side."

print w + e

Python Printing

We will now use Python printing to just type in code and let it run. We have already discussed this subject in detail because it is essentially the same.


print "Mary had a little lamb."
print "Its fleece was white as %s." % 'snow'
print "And everywhere that Mary went."
print "." * 10 # what'd that do?

end1 = "C"
end2 = "h"
end3 = "e"
end4 = "e"
end5 = "s"
end6 = "e"
end7 = "B"
end8 = "u"
end9 = "r"
end10 = "g"
end11 = "e"
end12 = "r"

# watch that comma at the end. try removing it to see what happens
print end1 + end2 + end3 + end4 + end5 + end6,
print end7 + end8 + end9 + end10 + end11 + end12
formatter = "%r %r %r %r"

print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
Here's some new strange stuff, remember type it exactly.

days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"

print "Here are the days: ", days
print "Here are the months: ", months

print """
There's something going on here.
With the three double- quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"""

 

Online Training Tutorials

  • Variant PrincipleWhat is Variant Principle in SAP?The variant principle there is 3 variants. They are 1.fiscal year variant 2.posting period variant3.feild status variant. The first customization is fiscal year variant. The variants […]
  • partner functionsWhat is Partner Functions in SAP SD?Partner functions is two-character identification key that describes the people and organization with whom you do the business, and who are therefore involved in transaction. Here is some […]
  • ASAP Methodology ImplementationASAP Methodology Implementation StepsThe SAP ASAP Methodology (Accelerated SAP) provides the roadmap for optimizing and continuous implementation of SAP systems in the real time business processes. The ASAP roadmap brings in […]
  • sap tutorial for beginnersSAP Tutorial: Free SAP Online Training TutorialsSAP is a leading ERP (Enterprise Resource Planning) provider and below will find major SAP modules with SAP tutorial help beginners and professional to learn different SAP modules include […]
  • sap-ehs-types-of-compositions-and-tutorialsSAP EHS Types of Compositions and TutorialsSAP EHS : One of the significant aspects to the success of Safety Datasheet Generation / distribution projects is to use and adopt the eixsting data structures. Even for meeting regulatory […]
  • sap crm course contentSAP CRM Course Content Modules TrainingCustomer Relationship Management SAP CRM Course Content SAP history and evolution Introduction to SAP-CRM CRM architecture ASAP methodology Base Customization 1), […]
  • Product Costing in SAPProduct Costing in SAP OverviewProduct costing is one of the important tools in SAP environment. It explains how to determine the cost of product or a unit. Product Costing is used to know the unit cost of the goods […]
  • General Ledger PlanningWhat is General Ledger Planning in SAP?General Ledger Planning can be done for general ledger wise in financial accounting exclusively. For that purpose we have to define the plan periods for the variant. Path: spro> […]