menu
bartleby
search
close search
Hit Return to see all results

Hi, please do you help with questions of Python? If so, I need help with the following:Write a program to:For loop print 1 to 25For loop print “A” to “Z”For loop print “a” to “z”Thank you.

Question

Hi, please do you help with questions of Python? If so, I need help with the following:

Write a program to:

  • For loop print 1 to 25
  • For loop print “A” to “Z”
  • For loop print “a” to “z”

Thank you.

check_circleAnswer
Step 1

Program Instructions:

  • Use range() to print from 1 to 25.
  • Use end in print() function to print the values separated by space.
  • Use ord() to provide the Unicode of the character.
  • Use chr() to convert the integer value into character.
Step 2

Program:

# to print 1 to 25

# end is used to end the each iteration with space instead of new line

for i in range(1,26):

  print(i,end =" ")

# print new line

print()

# to print a to z

for i in range(ord('a'), ord('z')+1):

    print(chr(i),end =" ")

#  or use this:

#for i in range(97,123):

#    print(chr(i),e...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Our solutions are written by experts, many with advanced degrees, and available 24/7

See Solution
Tagged in

Engineering

Computer Science

Python

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: This program uses hours, pay rate, state tax and fed tax to determine grossand net pay. The code is ...

A: Program Descriptions:The given program does not have any errors.It takes input from a file named pay...

question_answer

Q: 2. Write a program called ListOddNumbers that prints the below (there is a single space between each...

A: Solution: 2. The below program is written in Java language to display the odd number between 1 and 5...

question_answer

Q: Write a class in java with the name AgeMessages , which does the following:a. Ask the user to enter...

A: The algorithm for the program would be as below:Declare one float variable for accepting user inputP...

question_answer

Q: In a computer instruction format, the instruction length is 11 bits and the size of an address field...

A: Given:Instruction length = 11 bits = 211 = 2048 bitsAddress register size = 4 bits

question_answer

Q: Hello, please I need help with the following using Python:   Write flowchart, pseudo-code and progra...

A: Pseudocode:Import module statistics and Declare variables Students and Student_listPrompt for the nu...

question_answer

Q: Find regular grammars for the following languages on {a, b}: L = {w : na (w) and nb (w) are both eve...

A: Regular grammar for the language L = {W: na (w) and nb (w) are both even} is as follows:

question_answer

Q: Construct the XOR operator using only AND, OR, and NOT gates.

A: XOR gate:An XOR gate is referred to an Exclusive OR gate. The output of an XOR gate is “1” only when...

question_answer

Q: (The Fan class) Design a class named Fan to represent a fan. The class contains:■ Three constants na...

A: Java program to create Fan class is as follows:

question_answer

Q: Help.

A: Below is the algorithm:-start    function quadratic(a,b,c)        if a=0 then            display "no...

Sorry about that. What wasn’t helpful?