SlideShare a Scribd company logo
1 of 1
Q1. (5 points) Write a short program that simplifies the following code so that it does not use any
break or continue statements, yet the logic is equivalent, and the code outputs the counter value
of 126. counter = 0 while True: if counter >= 100 : break elif counter %2 = 0 : counter + = 1
continue else: counter = 2 ; continue print("counter:", counter) Q2. (5 points) Write a short
program that will: - prompt the user for a number - print out whether the number is a perfect
square and then end the program - prompt the user for another number if the input was not a
perfect square Suggestion: Import the math module and use the sqrt() function to find the square
root of a number. Example: import math math.sqrt(some_number) Sample Output:
============== Perfect Squares ============= Enter a number: 40 Not a perfect square.
Enter a number: 60 Not a perfect square. Enter a number: 100 100 is a perfect square. Q3. (5
points) Write a short program that prompts the user for an integer and prints the integer, but if
something other than an integer is input, the program keeps asking for an integer. Sample
Output: Enter an integer: a Enter an integer: a Enter an integer: b Enter an integer: % Enter an
integer: 3 The integer is: 3 Deliverable:

More Related Content

Similar to Simplify code without break/continue and print counter 126

Lab-11-C-Problems.pptx
Lab-11-C-Problems.pptxLab-11-C-Problems.pptx
Lab-11-C-Problems.pptxShimoFcis
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answersQuratulain Naqvi
 
c++ Question
c++  Questionc++  Question
c++ QuestionHamza4467
 
prathamesh .ppt 1.pptx
prathamesh  .ppt 1.pptxprathamesh  .ppt 1.pptx
prathamesh .ppt 1.pptxakashgorade1
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2Kaela Johnson
 
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchComputer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchSAKSHIGAWADE2
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.Haard Shah
 
Oop lab assignment 01
Oop lab assignment 01Oop lab assignment 01
Oop lab assignment 01Drjilesh
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfayush616992
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEWshyamuopeight
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_iElsayed Hemayed
 

Similar to Simplify code without break/continue and print counter 126 (20)

Programming Fundamental handouts
Programming Fundamental handoutsProgramming Fundamental handouts
Programming Fundamental handouts
 
03b loops
03b   loops03b   loops
03b loops
 
Lab-11-C-Problems.pptx
Lab-11-C-Problems.pptxLab-11-C-Problems.pptx
Lab-11-C-Problems.pptx
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
Cp manual final
Cp manual finalCp manual final
Cp manual final
 
17 Jo P May 08
17 Jo P May 0817 Jo P May 08
17 Jo P May 08
 
A01
A01A01
A01
 
c++ Question
c++  Questionc++  Question
c++ Question
 
prathamesh .ppt 1.pptx
prathamesh  .ppt 1.pptxprathamesh  .ppt 1.pptx
prathamesh .ppt 1.pptx
 
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORYGE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2
 
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchComputer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
 
I PUC CS Lab_programs
I PUC CS Lab_programsI PUC CS Lab_programs
I PUC CS Lab_programs
 
Oop lab assignment 01
Oop lab assignment 01Oop lab assignment 01
Oop lab assignment 01
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdf
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
 
Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_i
 

More from sngyun4t79

Presented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docxPresented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docxsngyun4t79
 
Practice the following diagnostic statements using your Manual ICD-10.docx
Practice the following diagnostic statements using your Manual  ICD-10.docxPractice the following diagnostic statements using your Manual  ICD-10.docx
Practice the following diagnostic statements using your Manual ICD-10.docxsngyun4t79
 
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docxPotentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docxsngyun4t79
 
Practice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docxPractice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docxsngyun4t79
 
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docxPrance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docxsngyun4t79
 
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl       Match each ecosystem-biome with its traditional mone.docxppl ppl ppl       Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docxsngyun4t79
 
Prepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docxPrepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docxsngyun4t79
 
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docxQ10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docxsngyun4t79
 
Python Create 3 variables named- userName result userNum Prompt the u.docx
Python Create 3 variables named- userName  result userNum Prompt the u.docxPython Create 3 variables named- userName  result userNum Prompt the u.docx
Python Create 3 variables named- userName result userNum Prompt the u.docxsngyun4t79
 
Python coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docxPython coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docxsngyun4t79
 
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docxPuerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docxsngyun4t79
 
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docxpublic static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docxsngyun4t79
 
Provide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docxProvide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docxsngyun4t79
 
Proteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docxProteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docxsngyun4t79
 
Proteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docxProteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docxsngyun4t79
 
Protective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docxProtective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docxsngyun4t79
 
Protein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docxProtein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docxsngyun4t79
 
project 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docxproject 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docxsngyun4t79
 
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docxPROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docxsngyun4t79
 
Positive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docxPositive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docxsngyun4t79
 

More from sngyun4t79 (20)

Presented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docxPresented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docx
 
Practice the following diagnostic statements using your Manual ICD-10.docx
Practice the following diagnostic statements using your Manual  ICD-10.docxPractice the following diagnostic statements using your Manual  ICD-10.docx
Practice the following diagnostic statements using your Manual ICD-10.docx
 
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docxPotentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
 
Practice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docxPractice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docx
 
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docxPrance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
 
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl       Match each ecosystem-biome with its traditional mone.docxppl ppl ppl       Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docx
 
Prepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docxPrepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docx
 
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docxQ10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docx
 
Python Create 3 variables named- userName result userNum Prompt the u.docx
Python Create 3 variables named- userName  result userNum Prompt the u.docxPython Create 3 variables named- userName  result userNum Prompt the u.docx
Python Create 3 variables named- userName result userNum Prompt the u.docx
 
Python coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docxPython coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docx
 
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docxPuerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docx
 
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docxpublic static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
 
Provide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docxProvide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docx
 
Proteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docxProteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docx
 
Proteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docxProteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docx
 
Protective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docxProtective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docx
 
Protein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docxProtein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docx
 
project 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docxproject 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docx
 
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docxPROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
 
Positive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docxPositive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docx
 

Recently uploaded

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 

Recently uploaded (20)

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 

Simplify code without break/continue and print counter 126

  • 1. Q1. (5 points) Write a short program that simplifies the following code so that it does not use any break or continue statements, yet the logic is equivalent, and the code outputs the counter value of 126. counter = 0 while True: if counter >= 100 : break elif counter %2 = 0 : counter + = 1 continue else: counter = 2 ; continue print("counter:", counter) Q2. (5 points) Write a short program that will: - prompt the user for a number - print out whether the number is a perfect square and then end the program - prompt the user for another number if the input was not a perfect square Suggestion: Import the math module and use the sqrt() function to find the square root of a number. Example: import math math.sqrt(some_number) Sample Output: ============== Perfect Squares ============= Enter a number: 40 Not a perfect square. Enter a number: 60 Not a perfect square. Enter a number: 100 100 is a perfect square. Q3. (5 points) Write a short program that prompts the user for an integer and prints the integer, but if something other than an integer is input, the program keeps asking for an integer. Sample Output: Enter an integer: a Enter an integer: a Enter an integer: b Enter an integer: % Enter an integer: 3 The integer is: 3 Deliverable: