What does this program print?
my_string= "abcde"
my_string= my_string[2:]+ "C" + my_string[3:]
print (my_string)
Wednesday, December 28, 2016
Thursday, December 15, 2016
Blog 35
Which will print AeCl ?
f_name= "Alice"
l_name= "Carmichael"
1) print f_name[0] + l_name[0]
2) print f_name[0] + l_name[0] + f_name[-1] + l_name[-1]
3) print f_name[0] + f_name[-1] + l_name[0] + l_name[-1]
4) print f_name[1:] + l_name[1:]
f_name= "Alice"
l_name= "Carmichael"
1) print f_name[0] + l_name[0]
2) print f_name[0] + l_name[0] + f_name[-1] + l_name[-1]
3) print f_name[0] + f_name[-1] + l_name[0] + l_name[-1]
4) print f_name[1:] + l_name[1:]
Monday, December 12, 2016
Blog 34
What does the find string return if the second string is not found in the first? What does it print?
for example
f_string= "hello"
s_string= "pig"
index=f_string.find(s_string)
print index
for example
f_string= "hello"
s_string= "pig"
index=f_string.find(s_string)
print index
Friday, December 9, 2016
blog 33
What is the result of these program lines?
greeting ="hello"
index= greeting.find('lo")
print index
greeting ="hello"
index= greeting.find('lo")
print index
Tuesday, December 6, 2016
blog 32
Look at the program below.
How do we fix it so it will print the string one letter at a time in the loop?
What one thing can we change to get it to work?
s= "hey dudes!"
for i in range(8):
print s[i]
How do we fix it so it will print the string one letter at a time in the loop?
What one thing can we change to get it to work?
s= "hey dudes!"
for i in range(8):
print s[i]
Sunday, December 4, 2016
blog 31
What does this program print?
my_string = "hello"
bad_index = len(my_string)
print (bad_index)
my_string = "hello"
bad_index = len(my_string)
print (bad_index)
Friday, December 2, 2016
Blog 30
Why does this program not work? What is wrong with it? How do you fix it?
def summ(x,y):
z= x+y
return z
print z
def summ(x,y):
z= x+y
return z
print z
Monday, November 28, 2016
Friday, November 25, 2016
Monday, November 21, 2016
Wednesday, November 16, 2016
Monday, November 14, 2016
Blog 25
Look at the code below. What does it print?
x=True
y=False
if x and y:
print "hello"
else:
print "hi"
x=True
y=False
if x and y:
print "hello"
else:
print "hi"
Wednesday, November 9, 2016
Monday, November 7, 2016
Blog 23
Tell me what this program prints.
x = 3
y = 3
while x > 3 or y < 6:
print x
print y
x = 9 - x
y = y + 2
x = 3
y = 3
while x > 3 or y < 6:
print x
print y
x = 9 - x
y = y + 2
Saturday, November 5, 2016
Blog 22
What does this program do?
How many times does the loop go through?
Write all the output lines. (what it prints)
x=10
while x >0:
print x
x = x - 3
How many times does the loop go through?
Write all the output lines. (what it prints)
x=10
while x >0:
print x
x = x - 3
Monday, October 31, 2016
Blog 21
Write a python program (using an IF-THEN-ELSE) that prints "I'm going to eat lunch inside!" if it is
raining, and "I'm going to eat lunch outside!" if it
is not raining. Raining should be a Boolean variable and try to do it in 5 lines.
raining, and "I'm going to eat lunch outside!" if it
is not raining. Raining should be a Boolean variable and try to do it in 5 lines.
Thursday, October 27, 2016
Blog 20
Write the pseudo code for the program description below. At least 3 sentences.
The program draws a square where the user inputs the length of the sides of the square.
The program draws a square where the user inputs the length of the sides of the square.
Monday, October 24, 2016
Tuesday, October 18, 2016
Sunday, October 16, 2016
Wednesday, October 12, 2016
Wednesday, October 5, 2016
Tuesday, October 4, 2016
Blog 12
Look at the code below. What is the error?
Print "Hi there!"
Print My favorite color is magenta.
Friday, September 30, 2016
Thursday, September 29, 2016
Monday, September 26, 2016
Thursday, September 22, 2016
Saturday, September 17, 2016
Blog 7
Tell why this program will not draw 4 diamonds. How do you fix it?
def draw_diamond():
left(45)
for i in range(4):
forward(20)
left(90)
right(45)
for i in range(4):
draw_diamond()
forward(50)
def draw_diamond():
left(45)
for i in range(4):
forward(20)
left(90)
right(45)
for i in range(4):
draw_diamond()
forward(50)
Tuesday, September 13, 2016
Sunday, September 11, 2016
Friday, September 9, 2016
Monday, September 5, 2016
Friday, September 2, 2016
Saturday, August 27, 2016
Subscribe to:
Comments (Atom)


