Free Essay

Chem

In: Science

Submitted By carreonjaninem
Words 257
Pages 2
ELEMENTS OF PROGRAMMING
Part 3

To understand iteration

To create loops in Python

To create programs with conditional and iteration statements

Iterative statements

The loop mechanism causes repeated execution of a sequence of statements as long as a certain condition is true.

Types of loops:

While loop

initialization

condition

update

Write a program that prints the integer cube root of an integer. If the input is not a perfect cube, it prints a message to that effect.

*Guttag, JV. Introduction to Computation Using Python

We used “guess and check” or exhaustive enumeration as our algorithmic technique.

For loop

can be defined by range, strings*, or lists*.

*We’ll use these for for loops when we get to these topics.

start

stop

step

Write a program that prints the sum of N integers.

What would be the output of the following code? Describe the program.

if-else + loops

Given an integer n, create a program that does a count down (to zero) if the integer is positive and does a count up (to zero) if the integer is negative.

Behavior changing keywords

exits out of the smallest enclosing loop.

terminates the loop and transfers execution to the statement after the loop

forces a loop to loop again, skipping the rest of body

Create a program that produces a random number and makes the user guess that number. Clues are given (higher or lower) to help the user guess the number.

Loop statements may have an clause which is executed when a loop is not terminated by a break.

Similar Documents

Premium Essay

Chem

...« Study and create flashcards for free at Cram.com Sign In | Sign Up StudyMode - Premium and Free Essays, Term Papers & Book Notes Essays Book Notes AP Notes Citation Generator More Experiment 4: properties of gases By swifty217, june 2013 | 2 Pages (480 Words) | 76 Views | 4.5 1 2 3 4 5 (1) | Report | This is a Premium essay for upgraded members Sign Up to access full essay DID YOU LIKE THIS? TELL YOUR FRIENDS... Send Report Submitted: June 21, 2013 Title: Properties of Gases Purpose: To analyze a few physical and chemical properties of gases as well as using those properties to identify the gases. Procedure: * For Hydrogen I placed a piece of Zn metal into a test tube with diluted HCl. * To produce oxygen I added Hydrogen peroxide to manganese. * Next, I added baking soda to vinegar. This caused a quick and energetic reaction! The gas from the reaction I pumped into some Limewater. * Then I mixed Alka Seltzer and water and pumped the gas caused by that reaction into some limewater. Data: Data Table: Experiment Results | Gas | Flame Reaction | Glowing Splint | Limewater reaction | Bromothymol blue reaction | Hydrogen | It enlarged the flame. | | | | Oxygen | It lit up quickly | | | | Hydrogen & oxygen | It puts it out. | | | | Carbon dioxide | It puts it out | | It bubbled and turned cloudy. | It turned it yellow | Alka Seltzer | | | Bubbles stayed in......

Words: 609 - Pages: 3

Premium Essay

Chem

...CHEM 111G – General Chemistry I Lab 1 Separation of the components of a mixture Aim of the experiment: To develop a stepwise procedure to separate the four components of a mixture of sand, salt, iodine and iron filings and determine the % of each by mass Brief procedure: The stepwise procedure was developed based on unique properties of each component: Salt: soluble in water Sand: insoluble in water Iodine: sublimes to vapor Iron: attracted to magnet We weighed out ~2g of the mixture in a 250mL beaker and chose to separate the iron first using a magnet. Since the iron sticks strongly to the magnet, the beaker + mixture was then reweighed to determine the mass of iron removed by difference. The iodine was then removed in the next step by placing the beaker on a hot plate covered by an ice cold evaporating dish and heating at maximum heat until no more purple iodine vapor were seen coming off. The deposited iodine crystals were recovered from the underside of the dish. Because some iodine is lost the beaker + mixture was then reweighed to determine the mass of iodine removed by difference. The remaining mixture of sand and salt was treated with deionized water to extract the salt (soluble). The sand was removed by filtration through a filter funnel via the water vacuum pump and the filtrate transferred to another weighed beaker. The salt was then recovered by evaporating the filtrate to dryness....

Words: 373 - Pages: 2

Free Essay

Chem

...,Y ; I ‘,, ‘..,* Introduccióna~la Termodinámica en m Ingeniería Química QUINTA EDICIÓN Smith l Van Nes Introducción a la Termodinámica en Ingeniería Química Introducción a la Termodinámica en Ingeniería Química Quinta edición J.M. Smith Profesor Emérito de Ingeniería Química University of California, Davis Profesor Emérito de Ingeniería Química Rensselaer Polytechnic Iris titu te Profesor de Ingeniería Química Rensselaer Polytechnic Institute TRADUCCIÓN: Edmundo G. Urbina Medal H. C. Van Ness M. M. Abbott Departamento de Ingeniería Eléctrica Universidad Autónoma Metropolitana lztapalapa María del Consuelo Hidalgo Mondragón Química Universidad Nacional Autónoma de México Doctorado en Química Profesor titular de Química general y Operaciones unitarias Escuela Superior de Ingeniería Química e Industrias Extractivas Instituto Politécnico Nacional REVISIÓN TÉCNICA: Ing. José Clemente Reza García McGRAW-HILL MÉXICO l BUENOS AIRES l CARACAS. GUATEMALA l LISBOA l MADRID l NUEVA’YORK PANAMÁ l SAN JUAN l SANTAFÉ DE BOGOTÁ. SANTIAGO l SÁO PAULO AUCKLAND l HAMBURGO l LONDRES l MILÁN l MONTREAL l NUEVA DEHLI l PARíS SAN FRANCISCO l SINGAPUR l ST. LOUIS l SIDNEY l TOKIO l TORONTO Gerente de producto: Alfonso García Bada Mena Supervisor de edición: Mateo Miguel García Supervisor de producción: Zeferino García García INTRODUCCIÓN A LA TERMODINÁMICA EN INGENIERÍA QUÍMICA Prohibida la reproducción total o parcial de esta obra, por cualquier......

Words: 37868 - Pages: 152

Premium Essay

Chem

...Rajdeep Singh Chem 2A Fregrene The Evolution of the Battery and Electric Vehicle After reading various articles on battery chemistry and how it applies to electric vehicles’ I have come to a conclusion. Although electric vehicles may seem like a great idea for many people, because they can eliminate a great amount of emission pollutants in the atmosphere, they arrive with many unresolved issues. Issues which may be expensive as well as incovineient to solve. The first article I read was “Chemstry’s Electric Oppurtunity” by Alex Scott. In his article, he spoke of the automobile firm Tesla and their new Model S vehicle. The Tesla Model S is a vehicle capable of driving up to 300 miles before needing to recharge, compared to the majority of other electric cars who can only reach 100 miles. The CEO of Tesla Motors, Elon R. Musk claims that “anything a gasoline based vehicle can do, the Model S can do” (Scott, pg 1). Which may prove to be true since the car goes from ‘0-60 in only 4.2’ (Scott, pg 1). Many people wonder how the Model S is capable of outperforming other electric vehicles. It is due to the car’s large 670kg battery. This battery provides an energy density of 240 Wh/Kg. ‘This is much denser than the nickel based batteries of other firms such as Toyota, Nissan, and GM’ (Scott, pg 2). It’s great that Tesla is able to raise the bar in the electric vehicle field and provide a more efficient vehicle for consumers to enjoy, however there is a large inhibitor....

Words: 850 - Pages: 4

Premium Essay

Chem

...Georgia Institute of Technology CHEM 3700 Research Paper The German Energiewende “Die deutsche Energiewende“ Professor: Dr. Thomas Orlando Student: Shyam Rangarajan Abstract With the diminishing reserves of fossil fuels compounded by their negative effects on the environment, clean and renewable sources of energy to meet next generation energy demands undoubtedly need to be found. However an even more critical aspect governing global energy challenges is the way governments around the world take responsible actions and implement energy policies that are conducive to a sustainable future. A recent development in this regard is the German Energiewende, or Energy Transformation, one of the most ambitious projects of its type. The project aims to completely transition the German energy sector to one powered by renewables by the year 2050. Along with the benefits to energy security and controlled carbon emissions that such a policy would bring, the German government‟s efforts have also sparked a wide-scale increase in investment into emerging technologies. This has led to a vast increase in employment in the energy sector, and has also given rise to the concept of „prosumers‟, or individuals who produce and sell their own electricity through privately owned solar installations. Although the long term benefits of this project are enormous and the potential limitless, there are several short term repercussions that are slowing it down....

Words: 3572 - Pages: 15

Premium Essay

Chem

...Chemical Reaction of Baking Soda and Lemon Juice CHM/110 August 2, 2012 Chemical Reaction of Baking Soda and Lemon Juice Baking powder and lemon juice are relatively versatile substances used in society’s daily lives. For example, the two have commonly used as natural cleaning solutions and cooking ingredients as well. The two products alone deemed as beneficial in households because they are inexpensive and are natural substances with healthier outcomes. Mixing lemon juice and baking powder makes a chemical reaction that results in what is virtually an outstanding cleaning paste, which uses to clean an entire house. Several useful purposes for the two substances endured and their results are impeccable. Useful Purposes: Lemon Juice and Baking soda Lemon juice is a multipurpose natural substance used in areas such as the following:  Cleaning Solutions  Flavor  Nutrition  Hair Dye “As a cleaning solution, lemon juice can rid hard water deposits and soap scum”, according to housekeeping.about.com (housekeeping.about.com, 2012). An inexpensive solution, no doubt, which is often already a product of one’s household. Cutting a lemon in half and sprinkling baking soda on all except the peeling, gets dishes moderately clean without the use of other un-natural cleaning solutions, such as dishwashing liquids that has to be purchase more often due to the quantitative usages. Society has been adding lemon product for flavor for centuries. Products of......

Words: 1044 - Pages: 5

Premium Essay

Chem

...PART A 1. Nuclear fission produces energy when energy is released from the breaking or splitting apart a large nucleus in smaller ones (breaks apart the nucleus). The total mass of the reactants is slightly more than the total mass of the products. 2. Nuclear reactors produce electricity from by using the heat from radioactive materials (fission reaction) to convert water into steam into a container that has fuel and the water. The water is then pumped through another container which has water to avoid the radioactive water coming in contact with the turbine. The heat from the primary water is used by the secondary water and water is then again, converted into steam. The secondary water is used to run the turbine generator to produce the electricity. The different components of a nuclear power plant are containment structure which houses the control rods, fuel rods, primary coolant, steam generator, pump and reactor vessel. When the steam flows out to the containment structure is passes through turbines, the condenser, condensate, secondary coolant and pump. From the condenser, warm water is pushed through to the cooling tower, then back to the body of water (water source). From the body of water, cooling water is passed through to the pump to carry it to the containment structure. From the turbine, steam is passed through generator, to release electricity for use. 3. The similarities between nuclear power plants and nuclear bombs are that they are......

Words: 567 - Pages: 3

Premium Essay

Chem

...Participation Participate in class discussion 3 of 7 days with at least 2 substantive posts on each of the three days. 2 Discussion Questions Respond to weekly discussion questions. DQ1:Wed DQ2:Sat 2 Nongraded Activities and Preparation Complete the Equation Editor tutorial and Virtual ChemLab Tutorial located on your student website. Individual Text Exercises, Part I Resources: Equation Editor tutorial Prepare written answers to the following assignments from Introductory Chemistry: • Exercise 20 in Ch. 1 • Exercise 120 in Ch. 2 • Exercise 112 in Ch. 3 • Exercise 120 in Ch. 4 • Exercise 100 in Ch. 5 • Exercise 126 in Ch. 6 • Exercise 116 in Ch. 7 • Exercise 100 in Ch. 8 Submit the assignment, as directed by your facilitator. Friday 5 Individual Virtual ChemLab Assignment 2-4 Access and view the Virtual ChemLab Tutorial, located on the student website. Complete 2-4: Precipitation Reactions from Virtual ChemLab: General Chemistry Laboratories, located on the student website. Note. To complete the assignment, the Virtual ChemLab software must be installed on your computer and must be used in conjunction with Virtual ChemLab: General Chemistry Laboratories. Installation requirements and instructions may be found in the workbook and on the accompanying CD. Once the software is installed, an electronic workbook may be found corresponding with your workbook, which contains preset lab assignments that match the workbook assignments. Use these......

Words: 1174 - Pages: 5

Premium Essay

Chem

...University of Phoenix Material Week 4 Exercises Prepare written answers to the following exercises: 1. Imagine that you are an environmental scientist. Working in collaboration with a university chemist, you were able to determine from mass spectrometry that four elements exist in your soil samples. They are Se, Sn, Pb, and Cd. You need to determine which elements will most likely combine with oxygen to produce oxides that are present in your sample. To do so, refer to the periodic table to determine the electron configuration and ionization energy of each element. This will show the number of valence electrons for each element. • What are the electron configurations for Se, Sn, Pb, and Cd? • What are the valence electrons for Se, Sn, Pb, and Cd? • Rank the elements in increasing ionization energy. • Which element will form oxides? 2. Imagine that, as an employee of a pharmaceutical company, you are working on an H-K-ATPase. It is the enzyme that pumps acid into the stomach to help in digestion. You are trying to determine whether a compound will fit inside the pocket of this enzyme in order to inhibit the enzyme. To do so, you must know the molecular shape of the compound. Draw the Lewis structure and determine the molecular geometry of the following compounds that may fit into the active site of this enzyme: 0. CO2 0. KOH 0. NO3 0. HCN 3. Imagine that you work as a chemist in a battery......

Words: 318 - Pages: 2

Free Essay

Chem

...Molecular Structures Molecular Structures Learning Objectives: - Understand covalent bonding displayed by elements in biological systems - Apply the octet rule - Practice converting molecular formulas into molecular structures - Be able to visualize and draw three dimensional molecular shapes Introduction: The octet rule states that most elements will share or exchange valence electrons in order to achieve a similar electron arrangement to the nearest noble gas. This concept is extremely important because it explains why elements bond to form compounds such as water, electrolytes, DNA, proteins and other biologically important substances. In this lab we will be focusing on a small palette of biologically important elements and studying how they covalently bond. In covalent compounds, the behavior of these elements tends to be consistent and predictable. Group Electron Arrangement Number of Bonds and Lone Pairs 1A 7A 1 bond and no lone pairs H X 6A X = F, Cl, Br or I O O O 6A Version: 3/22/16 S 1 bond and 3 lone pairs in biological systems Oxygen generally has 2 bonds and 2 lone pairs, but may have one bond and 3 lone pairs in anions such as hydroxide, or 3 bonds and 1 lone pair in cations such as hydronium. Sulfur has 2 bonds and 2 lone pairs in biological systems. Page 1 of 8 Molecular Structures 5A N Nitrogen generally forms 3 bonds with 1 lone pair, but may form 4 bonds with no lone pairs in......

Words: 783 - Pages: 4

Premium Essay

Chem

...E-Z NOTATION FOR GEOMETRIC ISOMERISM This page explains the E-Z system for naming geometric isomers. | | Important!  If you have come straight here via a search engine, you should be aware that this page follows on from anintroductory page about geometric isomerism. Unless you are already confident about how geometric isomers arise, and the cis-trans system for naming them, you should follow this link first. You will find links back to this current page at suitable points on that page. | The E-Z systemThe problem with the cis-trans system for naming geometric isomersConsider a simple case of geometric isomerism which we've already discussed on the previous page.You can tell which is the cis and which the trans form just by looking at them. All you really have to remember is that trans means "across" (as in transatlantic or transcontinental) and that cis is the opposite. It is a simple and visual way of telling the two isomers apart. So why do we need another system?There are problems as compounds get more complicated. For example, could you name these two isomers using cis and trans?Because everything attached to the carbon-carbon double bond is different, there aren't any obvious things which you can think of as being "cis" or "trans" to each other. The E-Z system gets around this problem completely - but unfortunately makes things slightly more difficult for the simple examples you usually meet in introductory courses. How the E-Z system......

Words: 2453 - Pages: 10

Premium Essay

Chem

...1. Food Classic Chemistry Demonstrations 69 69 THE ROYAL SOCIETY OF CHEMISTRY 29. The reaction between potassium permanganate and glycerol Topic Redox reactions. Exothermic reactions. This is also a spectacular ‘fun’ demonstration. Timing About 1 min. Level Any. Post-16 students may be able to appreciate the colours of the different oxidation states of manganese. Description Glycerol is poured onto potassium permanganate crystals. After a short lag time, steam is given off and a spectacular pink flame is produced. Apparatus w w One clean tin lid – from a sweet tin for example. Heat proof mat. Chemicals The quantities given are for one demonstration. w w 2–3 g of potassium permanganate (potassium manganate(VII)) in the form of fine crystals. About 1 cm3 of glycerol (propane-1,2,3-triol). Method The demonstration Put 2–3 g potassium permanganate on a tin lid standing on a heat-proof mat and make a well in the centre of the pile. Pour about 1 cm3 of glycerol into the well. After about 20 seconds, steam is given off and a bright pink flame is produced which burns for a few more seconds. Visual tips A white background is useful. The reaction would look spectacular in a dark room. Teaching tips Dissolve the residue in water and a green solution will be seen (suggesting Mn(VI)) as well as a brown solid (suggesting Mn(IV)). This confirms the redox nature of the reaction. Point out the lilac flame, which is characteristic of potassium salts....

Words: 442 - Pages: 2

Free Essay

Chem

...9.1 Multiple-Choice Questions 1) What is the nuclear symbol for a radioactive isotope of copper with a mass number of 60? A) B) C) D) E) Answer: A 2) The product from the alpha decay of is ________. A) B) C) D) E) Answer: C 3) The nuclear symbol of helium, , is also the symbol for designating a (n) A) proton. B) neutron. C) gamma ray. D) beta particle. E) alpha particle. Answer: E 4) The symbol is a symbol used for a(n) A) proton. B) neutron. C) gamma ray. D) beta particle. E) alpha particle. Answer: D 5) Which of the following types of radiation has the highest energy? A) α-particles B) β-particles C) γ-rays D) visible light E) All of these have the same energy. Answer: C 6) The damaging effects of radiation on the body are a result of A) the formation of unstable ions or radicals. B) the formation of radioactive atoms in the body. C) transmutation reactions in the body. D) extensive damage to nerve cells. E) the production of radioactive sodium ions in the body. Answer: A 7) Which of the following is suitable as a minimum shielding for beta particles? A) air B) 1 m of water C) gloves D) 1 m of concrete E) 1 cm of lead Answer: C 8) For , there are A) 85 protons and 38 neutrons. B) 47 protons and 38 neutrons. C) 38 protons and 47 neutrons. D) 38......

Words: 611 - Pages: 3

Free Essay

Chem

...Ranking Salt Solutions by pH 6-2: Ranking Salt Solutions by pH In this assignment you will be asked to rank aqueous solutions of acids, bases, and salts in order of increasing pH. This is most easily done by first identifying the strong acids that have the lowest pH, the strong bases that have the highest pH, and the neutral solutions that have a pH near 7. The weak acids will have a pH between 1 and 6 and the weak bases between 8 and 14. The exact order of weak acids and weak bases is determined by comparing the ionization constants (Ka for the weak acids and Kb for the weak bases). After ranking the pH of these solutions, you will then test your predictions in the laboratory. 1. Arrange the following 0.1 M solutions in order of increasing pH and state why you placed each solution in that position: NaCH3COO, HCl, HCN, NaOH, NH3, NaCN, KNO3, H2SO4, NH4Cl, H2SO3, NaHCO3, Na3PO4 and CH3COOH. In order of increasing pH: 1.HCl most powerful acid. 2.H2SO4 a strong acid 3.H2SO3 weak but stronger than 4.HCN from experiments 5.CH3COOH weak acid 6.NH4Cl is an acidic salt 7.KNO3 is Neutral salt 8.NaCH3COO NaCN NaHCO3 Na3PO4 are basic salts. 9.NH3 weak Base 10.NaOH strong Base After doing the experiment this is the order that I got: NH4Cl H2SO4 HCl H2SO3 KNO3 NaHCO3 CH3COOH NH3 HCN NaCH3COO NaCN Na3PO4 NaOH Once you have predicted the nature of each salt solution, you will use Virtual ChemLab to confirm your......

Words: 1119 - Pages: 5

Free Essay

Chem

...Practical 2 – UV-Visible Spectroscopy Iron in dietary supplements Introduction UV-Visible spectroscopy is an analytical technique involving measurement of the UV-visible light absorbed by substances, and is therefore commonly used for determining the concentration of a substance in a sample. Many substances absorb energies of particular wavelengths, while transmitting energy of other wavelengths. A UV-visible spectrum is produced when photons that are present in this particular region of the electromagnetic spectrum gain energy; causing electrons to jump from to higher energy levels than the ones they previously existed in. Not all substances have the same energy levels, since they vary from substance to substance. This in turn means that the energy and wavelength of the light required to move electrons from their energy levels also varies between substances. Hence it is possible to use the specific spectrum produced by each substance to identify what it is. A substance that absorbs light appears coloured, however the observable colour is the complement of the colour(s) absorbed, i.e. the colour not absorbed, since it is what remains to reach our eyes. UV-Visible spectroscopy can be used to obtain qualitative data, such as through identifying compounds using spectra compounds, or quantitative analysis. However, it is generally used for quantitative analysis, in order to determine the concentration of substance in a sample. In this procedure, the spectrum of the pure...

Words: 2220 - Pages: 9