SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
1. Given the for loop below that loops through a string by index, rewrite the code to loop through
the string by item so it prints the same thing as the original code. s= "This is quiz 4" for i in
range(len(s)): print(s[i])2. Modify the following code so that it does not throw an error when reading
the header of the file. f=open("file.csv","rrn) for line in f : vals=line.split(",")total=int(vals[3])+
int(vals[4])print("totalscorefor",vals[0],"and",vals[1],total) f.close0 file.csv homeTeam, vistingTeam,
week, homeScore, visitingScore Packers, Vikings, 1,43,34 Steelers, Giants, 1,26,16 Eagles,
Washington, 1,17,27 Rams,Eagles, 2,37,19 Broncos,Steelers, 2,21,26 Vikings, Colts, 2,11,28 3.
Write code to update a list, orig_list, from ['This', 'is', 'my', 'list'] to ['This', 'is','a', 'list', with,'7',
'values'] without just reassigning the variable orig list to a new list object.

Weitere ähnliche Inhalte

Ähnlich wie Loop through string characters and modify code to handle missing file header

第二讲 Python基礎
第二讲 Python基礎第二讲 Python基礎
第二讲 Python基礎juzihua1102
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎anzhong70
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumarSujith Kumar
 
C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxrohinitalekar1
 
9 character string & string library
9  character string & string library9  character string & string library
9 character string & string libraryMomenMostafa
 
L13 string handling(string class)
L13 string handling(string class)L13 string handling(string class)
L13 string handling(string class)teach4uin
 
Sql tables
Sql tablesSql tables
Sql tablesRanidm
 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to RAngshuman Saha
 
Data Manipulation with Numpy and Pandas in PythonStarting with N
Data Manipulation with Numpy and Pandas in PythonStarting with NData Manipulation with Numpy and Pandas in PythonStarting with N
Data Manipulation with Numpy and Pandas in PythonStarting with NOllieShoresna
 
13 Strings and text processing
13 Strings and text processing13 Strings and text processing
13 Strings and text processingmaznabili
 

Ähnlich wie Loop through string characters and modify code to handle missing file header (20)

第二讲 Python基礎
第二讲 Python基礎第二讲 Python基礎
第二讲 Python基礎
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
 
Python Datatypes by SujithKumar
Python Datatypes by SujithKumarPython Datatypes by SujithKumar
Python Datatypes by SujithKumar
 
Chapter05.ppt
Chapter05.pptChapter05.ppt
Chapter05.ppt
 
C (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptxC (PPS)Programming for problem solving.pptx
C (PPS)Programming for problem solving.pptx
 
P3 2018 python_regexes
P3 2018 python_regexesP3 2018 python_regexes
P3 2018 python_regexes
 
Java string handling
Java string handlingJava string handling
Java string handling
 
Arrays
ArraysArrays
Arrays
 
Python material
Python materialPython material
Python material
 
Data import-cheatsheet
Data import-cheatsheetData import-cheatsheet
Data import-cheatsheet
 
9 character string & string library
9  character string & string library9  character string & string library
9 character string & string library
 
R programming
R programmingR programming
R programming
 
L13 string handling(string class)
L13 string handling(string class)L13 string handling(string class)
L13 string handling(string class)
 
Python - Lecture 11
Python - Lecture 11Python - Lecture 11
Python - Lecture 11
 
Sql tables
Sql tablesSql tables
Sql tables
 
Sql tables
Sql tablesSql tables
Sql tables
 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to R
 
Data Manipulation with Numpy and Pandas in PythonStarting with N
Data Manipulation with Numpy and Pandas in PythonStarting with NData Manipulation with Numpy and Pandas in PythonStarting with N
Data Manipulation with Numpy and Pandas in PythonStarting with N
 
Array
ArrayArray
Array
 
13 Strings and text processing
13 Strings and text processing13 Strings and text processing
13 Strings and text processing
 

Mehr von cbholla1

1 Let X1 and X2 be independent and identically distributed .pdf
1 Let X1 and X2 be independent and identically distributed .pdf1 Let X1 and X2 be independent and identically distributed .pdf
1 Let X1 and X2 be independent and identically distributed .pdfcbholla1
 
1 Let X and Y have joint distributions function fxy93x.pdf
1 Let X and Y have joint distributions function fxy93x.pdf1 Let X and Y have joint distributions function fxy93x.pdf
1 Let X and Y have joint distributions function fxy93x.pdfcbholla1
 
1 Let X be a random variable with the cumulative distributi.pdf
1 Let X be a random variable with the cumulative distributi.pdf1 Let X be a random variable with the cumulative distributi.pdf
1 Let X be a random variable with the cumulative distributi.pdfcbholla1
 
1 Let x1x2xn form a random sample from a distribution g.pdf
1 Let x1x2xn form a random sample from a distribution g.pdf1 Let x1x2xn form a random sample from a distribution g.pdf
1 Let x1x2xn form a random sample from a distribution g.pdfcbholla1
 
1 Let X1Xn be a random sample from the Bernoulli distrib.pdf
1 Let X1Xn be a random sample from the Bernoulli distrib.pdf1 Let X1Xn be a random sample from the Bernoulli distrib.pdf
1 Let X1Xn be a random sample from the Bernoulli distrib.pdfcbholla1
 
1 Let X and Y be random variables defined on a common proba.pdf
1 Let X and Y be random variables defined on a common proba.pdf1 Let X and Y be random variables defined on a common proba.pdf
1 Let X and Y be random variables defined on a common proba.pdfcbholla1
 
1 Las personas que aprenden otro idioma cuando son nios p.pdf
1 Las personas que aprenden otro idioma cuando son nios p.pdf1 Las personas que aprenden otro idioma cuando son nios p.pdf
1 Las personas que aprenden otro idioma cuando son nios p.pdfcbholla1
 
1 La Sra Elle de 80 aos de edad es una paciente a quien.pdf
1 La Sra Elle de 80 aos de edad es una paciente a quien.pdf1 La Sra Elle de 80 aos de edad es una paciente a quien.pdf
1 La Sra Elle de 80 aos de edad es una paciente a quien.pdfcbholla1
 
1 La sntesis replicacin del ADN podra describirse para.pdf
1 La sntesis replicacin del ADN podra describirse para.pdf1 La sntesis replicacin del ADN podra describirse para.pdf
1 La sntesis replicacin del ADN podra describirse para.pdfcbholla1
 
1 Las caractersticas en dos grupos diferentes de organismo.pdf
1 Las caractersticas en dos grupos diferentes de organismo.pdf1 Las caractersticas en dos grupos diferentes de organismo.pdf
1 Las caractersticas en dos grupos diferentes de organismo.pdfcbholla1
 
1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdf
1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdf1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdf
1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdfcbholla1
 
1 Label the following diagram of the brachial plexus on Figu.pdf
1 Label the following diagram of the brachial plexus on Figu.pdf1 Label the following diagram of the brachial plexus on Figu.pdf
1 Label the following diagram of the brachial plexus on Figu.pdfcbholla1
 
1 Las acciones del presidente estadounidense Richard Nixon .pdf
1 Las acciones del presidente estadounidense Richard Nixon .pdf1 Las acciones del presidente estadounidense Richard Nixon .pdf
1 Las acciones del presidente estadounidense Richard Nixon .pdfcbholla1
 
1 La rotacin funcional suele resultar positiva para las or.pdf
1 La rotacin funcional suele resultar positiva para las or.pdf1 La rotacin funcional suele resultar positiva para las or.pdf
1 La rotacin funcional suele resultar positiva para las or.pdfcbholla1
 
1 In how many ways can you arrange the letters in the word.pdf
1 In how many ways can you arrange the letters in the word.pdf1 In how many ways can you arrange the letters in the word.pdf
1 In how many ways can you arrange the letters in the word.pdfcbholla1
 
1 La Sra Richards est embarazada y ha habido una posibili.pdf
1 La Sra Richards est embarazada y ha habido una posibili.pdf1 La Sra Richards est embarazada y ha habido una posibili.pdf
1 La Sra Richards est embarazada y ha habido una posibili.pdfcbholla1
 
1 La forma qumica del ozono es a O b O2 c O 3 d.pdf
1 La forma qumica del ozono es  a O  b O2   c O 3  d.pdf1 La forma qumica del ozono es  a O  b O2   c O 3  d.pdf
1 La forma qumica del ozono es a O b O2 c O 3 d.pdfcbholla1
 
1 In the 1950 s many scientists thought that proteins not.pdf
1 In the 1950 s many scientists thought that proteins not.pdf1 In the 1950 s many scientists thought that proteins not.pdf
1 In the 1950 s many scientists thought that proteins not.pdfcbholla1
 
1 La actividad principal de _____ es suscripcin A El di.pdf
1 La actividad principal de _____ es suscripcin  A El di.pdf1 La actividad principal de _____ es suscripcin  A El di.pdf
1 La actividad principal de _____ es suscripcin A El di.pdfcbholla1
 
1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdf
1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdf1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdf
1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdfcbholla1
 

Mehr von cbholla1 (20)

1 Let X1 and X2 be independent and identically distributed .pdf
1 Let X1 and X2 be independent and identically distributed .pdf1 Let X1 and X2 be independent and identically distributed .pdf
1 Let X1 and X2 be independent and identically distributed .pdf
 
1 Let X and Y have joint distributions function fxy93x.pdf
1 Let X and Y have joint distributions function fxy93x.pdf1 Let X and Y have joint distributions function fxy93x.pdf
1 Let X and Y have joint distributions function fxy93x.pdf
 
1 Let X be a random variable with the cumulative distributi.pdf
1 Let X be a random variable with the cumulative distributi.pdf1 Let X be a random variable with the cumulative distributi.pdf
1 Let X be a random variable with the cumulative distributi.pdf
 
1 Let x1x2xn form a random sample from a distribution g.pdf
1 Let x1x2xn form a random sample from a distribution g.pdf1 Let x1x2xn form a random sample from a distribution g.pdf
1 Let x1x2xn form a random sample from a distribution g.pdf
 
1 Let X1Xn be a random sample from the Bernoulli distrib.pdf
1 Let X1Xn be a random sample from the Bernoulli distrib.pdf1 Let X1Xn be a random sample from the Bernoulli distrib.pdf
1 Let X1Xn be a random sample from the Bernoulli distrib.pdf
 
1 Let X and Y be random variables defined on a common proba.pdf
1 Let X and Y be random variables defined on a common proba.pdf1 Let X and Y be random variables defined on a common proba.pdf
1 Let X and Y be random variables defined on a common proba.pdf
 
1 Las personas que aprenden otro idioma cuando son nios p.pdf
1 Las personas que aprenden otro idioma cuando son nios p.pdf1 Las personas que aprenden otro idioma cuando son nios p.pdf
1 Las personas que aprenden otro idioma cuando son nios p.pdf
 
1 La Sra Elle de 80 aos de edad es una paciente a quien.pdf
1 La Sra Elle de 80 aos de edad es una paciente a quien.pdf1 La Sra Elle de 80 aos de edad es una paciente a quien.pdf
1 La Sra Elle de 80 aos de edad es una paciente a quien.pdf
 
1 La sntesis replicacin del ADN podra describirse para.pdf
1 La sntesis replicacin del ADN podra describirse para.pdf1 La sntesis replicacin del ADN podra describirse para.pdf
1 La sntesis replicacin del ADN podra describirse para.pdf
 
1 Las caractersticas en dos grupos diferentes de organismo.pdf
1 Las caractersticas en dos grupos diferentes de organismo.pdf1 Las caractersticas en dos grupos diferentes de organismo.pdf
1 Las caractersticas en dos grupos diferentes de organismo.pdf
 
1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdf
1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdf1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdf
1 La tincin de viabilidad VIVOMUERTO se ha utilizado para.pdf
 
1 Label the following diagram of the brachial plexus on Figu.pdf
1 Label the following diagram of the brachial plexus on Figu.pdf1 Label the following diagram of the brachial plexus on Figu.pdf
1 Label the following diagram of the brachial plexus on Figu.pdf
 
1 Las acciones del presidente estadounidense Richard Nixon .pdf
1 Las acciones del presidente estadounidense Richard Nixon .pdf1 Las acciones del presidente estadounidense Richard Nixon .pdf
1 Las acciones del presidente estadounidense Richard Nixon .pdf
 
1 La rotacin funcional suele resultar positiva para las or.pdf
1 La rotacin funcional suele resultar positiva para las or.pdf1 La rotacin funcional suele resultar positiva para las or.pdf
1 La rotacin funcional suele resultar positiva para las or.pdf
 
1 In how many ways can you arrange the letters in the word.pdf
1 In how many ways can you arrange the letters in the word.pdf1 In how many ways can you arrange the letters in the word.pdf
1 In how many ways can you arrange the letters in the word.pdf
 
1 La Sra Richards est embarazada y ha habido una posibili.pdf
1 La Sra Richards est embarazada y ha habido una posibili.pdf1 La Sra Richards est embarazada y ha habido una posibili.pdf
1 La Sra Richards est embarazada y ha habido una posibili.pdf
 
1 La forma qumica del ozono es a O b O2 c O 3 d.pdf
1 La forma qumica del ozono es  a O  b O2   c O 3  d.pdf1 La forma qumica del ozono es  a O  b O2   c O 3  d.pdf
1 La forma qumica del ozono es a O b O2 c O 3 d.pdf
 
1 In the 1950 s many scientists thought that proteins not.pdf
1 In the 1950 s many scientists thought that proteins not.pdf1 In the 1950 s many scientists thought that proteins not.pdf
1 In the 1950 s many scientists thought that proteins not.pdf
 
1 La actividad principal de _____ es suscripcin A El di.pdf
1 La actividad principal de _____ es suscripcin  A El di.pdf1 La actividad principal de _____ es suscripcin  A El di.pdf
1 La actividad principal de _____ es suscripcin A El di.pdf
 
1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdf
1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdf1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdf
1 Kritik insan kaynaklar sorunlarnn zlmesine yardmc olma.pdf
 

Kürzlich hochgeladen

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Kürzlich hochgeladen (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

Loop through string characters and modify code to handle missing file header

  • 1. 1. Given the for loop below that loops through a string by index, rewrite the code to loop through the string by item so it prints the same thing as the original code. s= "This is quiz 4" for i in range(len(s)): print(s[i])2. Modify the following code so that it does not throw an error when reading the header of the file. f=open("file.csv","rrn) for line in f : vals=line.split(",")total=int(vals[3])+ int(vals[4])print("totalscorefor",vals[0],"and",vals[1],total) f.close0 file.csv homeTeam, vistingTeam, week, homeScore, visitingScore Packers, Vikings, 1,43,34 Steelers, Giants, 1,26,16 Eagles, Washington, 1,17,27 Rams,Eagles, 2,37,19 Broncos,Steelers, 2,21,26 Vikings, Colts, 2,11,28 3. Write code to update a list, orig_list, from ['This', 'is', 'my', 'list'] to ['This', 'is','a', 'list', with,'7', 'values'] without just reassigning the variable orig list to a new list object.