Wednesday, December 28, 2016

Blog 36

What does this program print?

my_string= "abcde"
my_string= my_string[2:]+ "C" + my_string[3:]
print (my_string)

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:]

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

Friday, December 9, 2016

blog 33

What is the result of these program lines?


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]

Sunday, December 4, 2016

blog 31

What does this program print?

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

Monday, November 28, 2016

Blog 29

What does this function print?

def negate(x):
    print -x

print negate(5)

Friday, November 25, 2016

Blog 28

What does this function print?

def get_number():
    return 12

x=get_number()
print x

Monday, November 21, 2016

Blog 27

What does the program below print?

for i in range(1, 11):
  print i

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"

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

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

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.

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.

Monday, October 24, 2016

Blog 19

How many possible values are there for a boolean variable? and what are the values?

Tuesday, October 18, 2016

Blog 18


 Write 2 lines of Comments for the code below.


number = int(input("Enter a number: "))
print "Five times that number is: " + str(number * 5)

Blog 17

What is the answer using python rules of operators?

6-3**2/(1+1)

Sunday, October 16, 2016

Wednesday, October 12, 2016

Wednesday, October 5, 2016

Blog 14

Look over the program below and tell me what the output would be.

x=2
y=2
print x+y

blog 13 real

Name the three things a variable has

1
2
3

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

Blog 11

Look at this code. What does it the printout look like?
print "Hello"
print "World"

Thursday, September 29, 2016

Blog 10

Go to this link on overclocking


What is clock rate?
Why do people overclock their computers?

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)

Tuesday, September 13, 2016

Sunday, September 11, 2016

Monday, September 5, 2016

Friday, September 2, 2016

Saturday, August 27, 2016

Blog 1

Which one of these is not a loop structure?

         Do While

         If Then Else

         While

         For Next Loop