SlideShare a Scribd company logo
week2
1)Aim: Print the below triangle using for loop.
rows = 6
for i in range(rows):
for j in range(i):
print(i, end=' ')
print('')
output
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
2)Aim:Write a program to check whether the given input is digit or lowercase
character or uppercase character or a special character (use 'if-else-if' ladder).
ch = input("Please Enter Your Own Character : ")
if(ch >= 'A' and ch <= 'Z'):
print("The Given Character ", ch, "is an Uppercase Alphabet")
elif(ch >= 'a' and ch <= 'z'):
print("The Given Character ", ch, "is a Lowercase Alphabet")
else:
print("The Given Character ", ch, "is Not a Lower or Uppercase Alphabet")
output
Please Enter Your Own Character : a
The Given Character a is a Lowercase Alphabet
Please Enter Your Own Character : 1
The Given Character 1 is Not a Lower or Uppercase Alphabet
Please Enter Your Own Character : A
The Given Character A is an Uppercase Alphabet
3)Aim:Python Program to Print the Fibonacci sequence
using while loop.
# Taking the number of terms to be printed as input
n = int(input("Enter the number of terms: "))
# Initializing the first two terms of the sequence
a, b = 0, 1
# Loop to print the Fibonacci sequence
while a < n:
print(a, end=" ")
a, b = b, a+b
Aim:Python Program to Print the Fibonacci sequence using while loop.
n = int(input("Enter the
number of terms: "))
a, b = 0, 1
while a < n:
print(a, end=" ")
a, b = b, a+b
output
Enter the number of terms: 15
0 1 1 2 3 5 8 13
4)Aim:Python program to print all prime numbers
in a given interval (usebreak).
lower = int(input("Enter lower bound: ")) # User inputs lower bound
upper = int(input("Enter upper bound: ")) # User inputs upper bound
print("Prime numbers between", lower, "and", upper, "are:")
for num in range(lower, upper + 1): # Loop through numbers in the given
range
if num > 1: # Prime numbers are greater than 1
for i in range(2, num): # Check divisibility from 2 to num-1
if (num % i) == 0: # If num is divisible, it's not prime
break # Exit loop early if a divisor is found
else:
print(num) # If no divisors are found, num is prime
lower = int(input("Enter lower bound: "))
upper = int(input("Enter upper bound: "))
print("Prime numbers between", lower, "and",
upper, "are:")
for num in range(lower, upper + 1):
if num > 1:
for i in range(2, num):
if(num % i) == 0:
break
else:
print(num)
output
Enter lower bound: 1
Enter upper bound: 22
Prime numbers between 1 and 22 are:
2
3
5
7
11
13
17
19
Ad

Recommended

Full Wave Rectifier (1).pptx its theory advantages and disadvantages
Full Wave Rectifier (1).pptx its theory advantages and disadvantages
doramira833
 
week3.pptx python related programs and outputs
week3.pptx python related programs and outputs
doramira833
 
3-Phase Induction Motor.pptx with clear explanation
3-Phase Induction Motor.pptx with clear explanation
doramira833
 
Python expampless problems with output and reason
Python expampless problems with output and reason
doramira833
 
2024 Trend Updates: What Really Works In SEO & Content Marketing
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
 
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
 
Exploring the Diverse Types of Textual Aids
Exploring the Diverse Types of Textual Aids
jenicahmendoza1
 
User Persona for a fitness CEO Founder
User Persona for a fitness CEO Founder
modele dawodu
 
Nueva presentación para diapositivas de power point.pdf
Nueva presentación para diapositivas de power point.pdf
SubaruKun1
 
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
14ANUSHAVPARCHI
 
Formal Informal Apology letter.pptxvvvvv
Formal Informal Apology letter.pptxvvvvv
iqlimajurayeva
 
FLOURISHING THROUGH SENSES: FROM Ab‘SENSE’ to Pre‘SENSE’ to Es‘SENSE’ to Re-...
FLOURISHING THROUGH SENSES: FROM Ab‘SENSE’ to Pre‘SENSE’ to Es‘SENSE’ to Re-...
Samuel Thuo
 
fire123xx2-blogspot-com-2025-06-fire-certificate-requirements-in-html.pdf
fire123xx2-blogspot-com-2025-06-fire-certificate-requirements-in-html.pdf
riyaarenainfosloutio
 
Why_Do_Cats_Act_So_Weird.pptxbdhshshshshshh
Why_Do_Cats_Act_So_Weird.pptxbdhshshshshshh
zyx10283746
 
The_Sciencehggshshs_of_Everyday_Luck.pptx
The_Sciencehggshshs_of_Everyday_Luck.pptx
zyx10283746
 
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
Taqyea
 
Computer Aided Design Introduction Lecture
Computer Aided Design Introduction Lecture
ShavinGopee2
 
AUTOMATIC NUMBER PLATE RECOGNITION 1.pptx
AUTOMATIC NUMBER PLATE RECOGNITION 1.pptx
ABHISHEKCHAKRABORTY931369
 
Radiation_Pollution_eLearning_Module.pptx
Radiation_Pollution_eLearning_Module.pptx
kanishkaarora1496
 
Internet Download Manager (IDM) Crack Free Download 2025
Internet Download Manager (IDM) Crack Free Download 2025
Designer
 
Chromatic house a case study presentation arch.pptx
Chromatic house a case study presentation arch.pptx
maheshwarigarvit2006
 
Numbers 1 to 100 Circle Flashcard s.pptx
Numbers 1 to 100 Circle Flashcard s.pptx
KarenGimena1
 
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
MaKristinaBuenaventu1
 
roadsafety_training_manual_unit_1_magnitude_and_impact.ppt
roadsafety_training_manual_unit_1_magnitude_and_impact.ppt
mbkl05cctjv
 
Transformative Storytelling_ Insights from the Sankofa Writing Intensive.pdf
Transformative Storytelling_ Insights from the Sankofa Writing Intensive.pdf
Dr. Rema
 
Simone Laubscher ABC: Redefining Sustainable Luxury in the UAE Fashion Scene
Simone Laubscher ABC: Redefining Sustainable Luxury in the UAE Fashion Scene
Simone Laubscher ABC
 
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 

More Related Content

Recently uploaded (20)

Exploring the Diverse Types of Textual Aids
Exploring the Diverse Types of Textual Aids
jenicahmendoza1
 
User Persona for a fitness CEO Founder
User Persona for a fitness CEO Founder
modele dawodu
 
Nueva presentación para diapositivas de power point.pdf
Nueva presentación para diapositivas de power point.pdf
SubaruKun1
 
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
14ANUSHAVPARCHI
 
Formal Informal Apology letter.pptxvvvvv
Formal Informal Apology letter.pptxvvvvv
iqlimajurayeva
 
FLOURISHING THROUGH SENSES: FROM Ab‘SENSE’ to Pre‘SENSE’ to Es‘SENSE’ to Re-...
FLOURISHING THROUGH SENSES: FROM Ab‘SENSE’ to Pre‘SENSE’ to Es‘SENSE’ to Re-...
Samuel Thuo
 
fire123xx2-blogspot-com-2025-06-fire-certificate-requirements-in-html.pdf
fire123xx2-blogspot-com-2025-06-fire-certificate-requirements-in-html.pdf
riyaarenainfosloutio
 
Why_Do_Cats_Act_So_Weird.pptxbdhshshshshshh
Why_Do_Cats_Act_So_Weird.pptxbdhshshshshshh
zyx10283746
 
The_Sciencehggshshs_of_Everyday_Luck.pptx
The_Sciencehggshshs_of_Everyday_Luck.pptx
zyx10283746
 
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
Taqyea
 
Computer Aided Design Introduction Lecture
Computer Aided Design Introduction Lecture
ShavinGopee2
 
AUTOMATIC NUMBER PLATE RECOGNITION 1.pptx
AUTOMATIC NUMBER PLATE RECOGNITION 1.pptx
ABHISHEKCHAKRABORTY931369
 
Radiation_Pollution_eLearning_Module.pptx
Radiation_Pollution_eLearning_Module.pptx
kanishkaarora1496
 
Internet Download Manager (IDM) Crack Free Download 2025
Internet Download Manager (IDM) Crack Free Download 2025
Designer
 
Chromatic house a case study presentation arch.pptx
Chromatic house a case study presentation arch.pptx
maheshwarigarvit2006
 
Numbers 1 to 100 Circle Flashcard s.pptx
Numbers 1 to 100 Circle Flashcard s.pptx
KarenGimena1
 
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
MaKristinaBuenaventu1
 
roadsafety_training_manual_unit_1_magnitude_and_impact.ppt
roadsafety_training_manual_unit_1_magnitude_and_impact.ppt
mbkl05cctjv
 
Transformative Storytelling_ Insights from the Sankofa Writing Intensive.pdf
Transformative Storytelling_ Insights from the Sankofa Writing Intensive.pdf
Dr. Rema
 
Simone Laubscher ABC: Redefining Sustainable Luxury in the UAE Fashion Scene
Simone Laubscher ABC: Redefining Sustainable Luxury in the UAE Fashion Scene
Simone Laubscher ABC
 
Exploring the Diverse Types of Textual Aids
Exploring the Diverse Types of Textual Aids
jenicahmendoza1
 
User Persona for a fitness CEO Founder
User Persona for a fitness CEO Founder
modele dawodu
 
Nueva presentación para diapositivas de power point.pdf
Nueva presentación para diapositivas de power point.pdf
SubaruKun1
 
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
14ANUSHAVPARCHI
 
Formal Informal Apology letter.pptxvvvvv
Formal Informal Apology letter.pptxvvvvv
iqlimajurayeva
 
FLOURISHING THROUGH SENSES: FROM Ab‘SENSE’ to Pre‘SENSE’ to Es‘SENSE’ to Re-...
FLOURISHING THROUGH SENSES: FROM Ab‘SENSE’ to Pre‘SENSE’ to Es‘SENSE’ to Re-...
Samuel Thuo
 
fire123xx2-blogspot-com-2025-06-fire-certificate-requirements-in-html.pdf
fire123xx2-blogspot-com-2025-06-fire-certificate-requirements-in-html.pdf
riyaarenainfosloutio
 
Why_Do_Cats_Act_So_Weird.pptxbdhshshshshshh
Why_Do_Cats_Act_So_Weird.pptxbdhshshshshshh
zyx10283746
 
The_Sciencehggshshs_of_Everyday_Luck.pptx
The_Sciencehggshshs_of_Everyday_Luck.pptx
zyx10283746
 
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
最新版西班牙拉蒙鲁尔大学毕业证(URL毕业证书)原版定制
Taqyea
 
Computer Aided Design Introduction Lecture
Computer Aided Design Introduction Lecture
ShavinGopee2
 
Radiation_Pollution_eLearning_Module.pptx
Radiation_Pollution_eLearning_Module.pptx
kanishkaarora1496
 
Internet Download Manager (IDM) Crack Free Download 2025
Internet Download Manager (IDM) Crack Free Download 2025
Designer
 
Chromatic house a case study presentation arch.pptx
Chromatic house a case study presentation arch.pptx
maheshwarigarvit2006
 
Numbers 1 to 100 Circle Flashcard s.pptx
Numbers 1 to 100 Circle Flashcard s.pptx
KarenGimena1
 
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
Grade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptxGrade-9-COT.pptx
MaKristinaBuenaventu1
 
roadsafety_training_manual_unit_1_magnitude_and_impact.ppt
roadsafety_training_manual_unit_1_magnitude_and_impact.ppt
mbkl05cctjv
 
Transformative Storytelling_ Insights from the Sankofa Writing Intensive.pdf
Transformative Storytelling_ Insights from the Sankofa Writing Intensive.pdf
Dr. Rema
 
Simone Laubscher ABC: Redefining Sustainable Luxury in the UAE Fashion Scene
Simone Laubscher ABC: Redefining Sustainable Luxury in the UAE Fashion Scene
Simone Laubscher ABC
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Ad

week2.pptx program program program problems

  • 2. 1)Aim: Print the below triangle using for loop. rows = 6 for i in range(rows): for j in range(i): print(i, end=' ') print('')
  • 3. output 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
  • 4. 2)Aim:Write a program to check whether the given input is digit or lowercase character or uppercase character or a special character (use 'if-else-if' ladder). ch = input("Please Enter Your Own Character : ") if(ch >= 'A' and ch <= 'Z'): print("The Given Character ", ch, "is an Uppercase Alphabet") elif(ch >= 'a' and ch <= 'z'): print("The Given Character ", ch, "is a Lowercase Alphabet") else: print("The Given Character ", ch, "is Not a Lower or Uppercase Alphabet")
  • 5. output Please Enter Your Own Character : a The Given Character a is a Lowercase Alphabet Please Enter Your Own Character : 1 The Given Character 1 is Not a Lower or Uppercase Alphabet Please Enter Your Own Character : A The Given Character A is an Uppercase Alphabet
  • 6. 3)Aim:Python Program to Print the Fibonacci sequence using while loop. # Taking the number of terms to be printed as input n = int(input("Enter the number of terms: ")) # Initializing the first two terms of the sequence a, b = 0, 1 # Loop to print the Fibonacci sequence while a < n: print(a, end=" ") a, b = b, a+b
  • 7. Aim:Python Program to Print the Fibonacci sequence using while loop. n = int(input("Enter the number of terms: ")) a, b = 0, 1 while a < n: print(a, end=" ") a, b = b, a+b output Enter the number of terms: 15 0 1 1 2 3 5 8 13
  • 8. 4)Aim:Python program to print all prime numbers in a given interval (usebreak). lower = int(input("Enter lower bound: ")) # User inputs lower bound upper = int(input("Enter upper bound: ")) # User inputs upper bound print("Prime numbers between", lower, "and", upper, "are:") for num in range(lower, upper + 1): # Loop through numbers in the given range if num > 1: # Prime numbers are greater than 1 for i in range(2, num): # Check divisibility from 2 to num-1 if (num % i) == 0: # If num is divisible, it's not prime break # Exit loop early if a divisor is found else: print(num) # If no divisors are found, num is prime
  • 9. lower = int(input("Enter lower bound: ")) upper = int(input("Enter upper bound: ")) print("Prime numbers between", lower, "and", upper, "are:") for num in range(lower, upper + 1): if num > 1: for i in range(2, num): if(num % i) == 0: break else: print(num)
  • 10. output Enter lower bound: 1 Enter upper bound: 22 Prime numbers between 1 and 22 are: 2 3 5 7 11 13 17 19