3/14/2017
5 Unit Contents
Unit 5
Section A: Social Networking
Section B: Content Communities
Section C: Blogs and More
Section D: Online Communication
Section E: Social Media Values
Social Media
Computer Concepts 2016
Unit 5: Social Networking
5
2
5 Objec
# w3ex11.py
# Week 3, exercise 11
def main():
print("This script computes the sum of the first n numbers.")
print()
n = eval(input("Enter a positive whole number n: ")
total_sum = 0
for i in range(1, n + 1):
total_sum = total_sum + i
print("The sum of the
# w3ex6.py
# Week 3, exercise 6
def main():
print("This script computes the slope of the line determined by two points.")
print()
x1, y1 = eval(input("Enter the first point (x,y): ")
x2, y2 = eval(input("enter the second point (x,y): ")
slope = (y2 - y1)
# w3ex12.py
# Week 3, exercise 12
def main():
print("This script computes the sum of the cubes of the first n numbers.")
print()
n = eval(input("Enter a positive whole number n: ")
total_sum = 0
for i in range(1, n + 1):
total_sum = total_sum + (i * 3)
pr
# w3ex13.py
# Week 3, exercise 13
def main():
print("This program sums up numbers entered by the user.")
print()
n = eval(input("Enter how many numbers you would like to sum up: ")
total_sum = 0
for i in range(n):
num = eval(input("Enter a number: ")
tota
# w3ex16.py
# Week 3, exercise 16
def main():
print("This script computes Fibonacci numbers.")
print()
n = eval(input("Enter a value for n so I will compute the n-th Fibonacci
number: ")
fibonacci = 1
prev_fibonacci = 0
for i in range(n - 1):
temporary =
# w5ex10.py
# Week 5, exercise 10.
def main():
print("This program computes the average word length in a sentence.")
print()
# obtain input
sentence = input("Etner a sentence: ")
# compute the average word length
words = sentence.split()
# split up into w
# w5ex11.py
# Week 5, exercise 11.
def main():
print("This is an improved chaos demonstration.")
print()
#
x
y
n
Obtain input
= eval(input("Enter a number between 0 and 1: ")
= eval(input("Enter another number between 0 and 1: ")
= eval(input("How many li
# w6ex3.py
# Week 6, exercise 3.
from math import *
def sphereArea(radius):
return 4 * pi * (radius * 2)
def sphereVolume(radius):
return 4/3 * pi * (radius * 3)
def main():
print("This script computes the volume and surface area of a sphere given
its rad
# Week 6 Lab template.
# Below is the definition of a function, in which you need to fill in the code.
#
#
#
#
#
#
#
#
#
#
#
#
#
#
During the lab you were required to define the functions sumN and sumCubesN.
The function below accepts two parameters, n an
# w5ex6.py
# Week 5, exercise 6.
def main():
print("This program computes the nummeric value of a full name.")
print()
# Obtain input
full_name = input("Enter a name: ")
original = full_name
# keep a copy of what the user actually
typed
full_name = full_n
# w5ex4.py
# Week 5, exercise 5.
def main():
print("This program computes the nummeric value of a name.")
print()
# Obtain input
name = input("Enter a name: ")
# Compute nummeric value of the input
name = name.lower()
# make sure all letters are lower cas
# Week 6 Lab template.
# Below is the definition of a function, in which you need to fill in the code.
#
#
#
#
#
#
#
#
#
#
#
#
#
#
During the lab you were required to define the functions sumN and sumCubesN.
The function below accepts two parameters, n an
# w5ex4.py
# Week 5, exercise 4.
def main():
print("This program produces the acronym of a phrase.")
print()
# Obtain input from the use, the phrase to process
phrase = input("Enter a phrase: ")
# Compute the acronym
acronym = "
# start with an empty acro
#
#
#
#
#
#
Fill in the details so that the functions below work as described.
Do not include a main function. Simply follow the instructions carefully.
Test your functions extensively by running the script, and invoking the
function from the shell on val