Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science
3rd Edition
ISBN: 9781590282779
Author: John Zelle
Publisher: Franklin Beedle & Associates
bartleby

Concept explainers

bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 3, Problem 4D

Explanation of Solution

a)

Given code segment:

#Loop from 1 to 11

for i in range(1, 11):

  #Print square of the number

  print(i * i)

Explanation:

Explanation of Solution

b)

Given code segment:

#Iterate the list

for i in [1, 3, 5, 7, 9]:

 #Print the cube of each value

 print(i, ":", i ** 3)

#print the value of i

print(i)

Explanation:

Explanation of Solution

c)

Given code segment:

#Declare required variables

x = 2

y = 10

#Loop

for j in range(0, y, x):

 #Print the value of j

 print(j, end = "")

 #Print the value of x+y

 print(x + y)

#print done

print("done")

Explanation:

Explanation of Solution

d)

Given code segment:

#Declare required variables

ans = 0

#Loop

for i in range(1, 11):

 #Calculate the value of ans

 ans = ans + i * i

 #Print the value of i

 print(i)

#print the value of ans

print(ans)

Explanation:

Blurred answer
Students have asked these similar questions
Q1/ The transistor in the circat below is specified to have ẞ in the rang 50 to 150 Find the Value of RB that results in Saturation with an overdrive factor of at Least 10 3 lov 1 кл 5V RB
edit: D:\Ahmad Saeedab20 21\Lab 08.02.asm file edit bookmarks assembler emulator math ascii codes 81 LAB 8.2: PUSHF POPF 82 83 org 188h 84 85 -CODE 86 MOU CL. 97H 82 88 LEA SI. FLGS variables 0x FLGS FLCK show a hex 0001h, 0004h, 0010h, 0040h, 0080h, 0400h, 0800h 8083h, 8086h, 0812h, 0842h, 8882h, 8482h, 0882h Random Access Memory 89 LEA DI, FLGR 18 11 L1: MOU AX. [S1] 12 13 PUSH AX FLGS MEM -> AX AX STACK MEM 0700:0117 STACK MEMPLAG REG FLAG REG->STACK MEM POPF PUSHF POP STACK MEM -> AX -> FLGR MEM INC SI INC SI INC DI INC DI LOOP L1 NULL FLGS 8788:8117: 81 881 0708:0118: 88 888 0788:0119: 84 884 8788:811A: 88 888 NULL 0788:8118: 18 816 ▸ 0708:011C: 8788-8115 0788 ULL Source Meme Shorten the paragraph in one update C table 9 878 8788 8788 9786 0788 888 NULL step 884 000 NULL 8288Harz AR BACK 0700:01251 83 883 ▾ SET CF DATA PP AF ZF SP DF OF 33 PLGS DU 8881H, 8884H, 0810H, 8848H, 8880H, 0400H, 0888н 34 FLGR DW 7H DUP Control Fa OF DF IF TF SF ZF XAF XPF x CF 8788:0126: 88 888…
Create a class named StudentRecords and add a static variable named records, which is a list shared among all objects of the class. Then add a method named add_record that takes a student's name as input and appends it to the shared records list.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Computational Software for Intelligent System Design; Author: Cadence Design Systems;https://www.youtube.com/watch?v=dLXZ6bM--j0;License: Standard Youtube License