All summed up

Last Task combined all of Part 1. The task wanted a program which let you input 2 numbers and "sum up" everything between them the example.
First: 1
Last: 7
1
3
6
10
15
21
28
The programming involved using the maths from the information given and applying it to this. Grok so far hasn't been too bad but personally having no experience with python, felt like I need better explanation with certain elements of the coding. This half of the week though was fairly challenging but with a bit of help was manageable.  In this half of the week I learnt the following
  • for loops
  • Looping over a string
  • Looping over a range of numbers
  • Doing maths with loops

Countdown to B-day!

Third Task- The program needed the user to enter how many day to go until their birthday and the program had to respond with a list of _ days to go or _day to go.For this to work I programmed it to ask How many days to go? then used looping and range,with -1 to go backwards. Then used if  and i== 1 to print day to go and else for days to go.

The coding
count = input("How many days to go?: ")
for i in range(int(count),0, -1):
  if (i ==1 ):
      print(i, "day to go.")
  else:
      print(i,"days to go.")
 

Multiplication Drill


Second task of the week was not too challenging, it was just making sure I had the right maths work and making sure I remembered to change the variable to a integer. The program needed to print the multiplication of an input up to 12 e.g. 1x2 2x2 3x3 etc. This meant I had to loop it but make it stop at 12. For this grok used range which let you put a break/ limit on how many times it loops before stopping. The range function goes with the for in. 

Bingo was his name-o!

Bingo was his name- o! was the first task of week 3. The task required the user to enter a dogs name for the input and print it in upper case and separated like the song using the users input.
For this to work I needed to loop through the variable (which in this case was the dog's name input) and print it in the for in upper case. Lastly I printed " And Bingo was his name-o!" The task wasn't to hard to complete as it was simple to follow the information given.

name = input("Dog's name: ")
for c in name:
  print(c.upper())

print("And",name,"was his name-o!")