New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Concepts of Computing

by: Ashleigh Dare

Concepts of Computing ECS 010

Ashleigh Dare
GPA 3.75


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Engineering Computer Science

This 2 page Class Notes was uploaded by Ashleigh Dare on Tuesday September 8, 2015. The Class Notes belongs to ECS 010 at University of California - Davis taught by Staff in Fall. Since its upload, it has received 13 views. For similar materials see /class/191718/ecs-010-university-of-california-davis in Engineering Computer Science at University of California - Davis.

Similar to ECS 010 at UCD

Popular in Engineering Computer Science


Reviews for Concepts of Computing


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/08/15
ECS 10 Basic Concepts of Computing Spring Quarter 2009 Printing Python offers several ways to print information This handout presents two using the print statement Unform atted Printing Unformatted printing prints numbers and strings in a natural format integers as ordinary numbers oating point numbers with two decimal digits and strings as they are typed Thus num l flnum 26 print quotThe integer isquot num quotand the float isquot flnum prints The integer is l and the float is 26 A comma between two arguments prints a space a comma at the end of the line suppresses the skip to the next line print quotHere is one print statementquot print quotAnd here is anotherquot prints Here is one print statement And here is another One problem with unformatted printing is that you cannot avoid adding spaces before numbers So if you try to print 139 with this print quotquot 139 you get 1 39 notice the unwanted space To print this you need a formatted print statement Formatted Print A formatted print statement allows you to control how the number or string is printed You can do lots of things with it that you cannot do with an unformatted print statement Let s start with the last unformatted print problem We want to print 139 Here s how we do it print quotfquot 139 This prints 139000O The string immediately following the printf is the format string It is printed as typed except when a is seen The sequence of characters following it control how the next arguments are to be printed f means to print a oating point number d would mean to print an integer Version of Aprl 8 2009 at 1021 AM Page 1 of2 ECS 10 Basic Concepts of Computing Spring Quarter 2009 as a decimal number d stands for decimal The after the string says that the arguments for the printing follow The arguments are enclosed in parentheses1 One problem with the aboveitoo many decimal places Let s restrict it to 2 decimal places by saying instead print quot2fquot 139 which prints 139 The f says to print the number as a oating point number The 2 between the and f means to print 2 digits after the decimal point As another example if you want to print the value OfJ39IS to 7 decimal places say import math print quotThe value of pi is 7fquot mathpi You get The value of pi is 31415927 Now let s say we want to print several arguments You do it this way print quotd d dquot 2 2 2 2 gives 2 2 4 You can get very fancy print 391anguages has O3d quote types quotquot 2 391anguage39 quotPythonquot gives Python has 002 quote types What Is Actually Going On Actually the arguments to print are simply a way to write a string Ignore the word print Then the string in quotes is called the format string and the parenthesized list following the are the values The values are substituted into the format string resulting in a new string To see this type the following to the IDLE interpreter x quot2 f fquot mathpi 2mathpi print x and you will see 2 3141593 6283185 1 Actually if there is only one argument to be printed you can omit the parentheses But it s easier to remember them if you always put them in Version of Aprl 8 2009 at 1021 AM Page 2 of2


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.