Skip to content

Exercises from the course Programming Building Blocks from Brigham Young University-Idaho (BYU-Pathway Worldwide).

Notifications You must be signed in to change notification settings

Antariex/Introduction-to-Programming

Repository files navigation

Introduction-to-Programming

Exercises from the course Programming building blocks from Brigham Young University-Idaho (BYU-Pathway Worldwide).

CSE 110 is designed to be a first introduction to programming. In it, the student will learn the basic building blocks of programming and how to use them to accomplish meaningful tasks. After taking this course, the student will be prepared to use programming in his own areas of interest and to learn more about programming in future courses.

  • Technology:
    This course will use Python 3 for programming and Visual Studio Code.

Course Outcomes

  1. Use programming building blocks (variables, conditionals, loops, lists) to accomplish meaningful tasks in a variety of domains.
  2. Develop confidence in learning new programming skills.

List of exercices:

Activity Title Instructions Overview
Your First Program (color.py) Write a program that uses both input (obtaining data from the user via the keyboard) and output (displaying data to the user on the screen). A program that asks a user for their favorite color, then allow them to type in their color. Finally, have the program respond to them by displaying the text "Your favorite color is" followed by the color they typed.
Input and Output (name.py) Prompt the user for their first name. Then, prompt them for their last name. Display the text back all on one line saying, "Your name is last-name, first-name, last-name". Use the .title() function on each variable so that it capitalizes only the first letter and all the other letters are lowercase. An iconic line from the James Bond movies is that he would introduce himself as "Bond, James Bond." This program asks for the users´s name and repeats it back in this way.
ID Badge Generator (badge.py) Write a program to prompt the user for the following: First name, Last name, Email Address, Phone Number, Job Title, ID Number. Then you should display the information back in certain format. In addition, you must implement the following requirements: the last name should be converted from whatever the user types to be displayed in ALL CAPS; the job title should be displayed so that the first letter is capitalized; and the email address should be displayed in all lowercase. Also: add hair color and eye color and put them both on the same line in the display; add a field for the name of the month they started and also a yes/no field for whether they have completed advanced training. Put these both on the same line in the display; for the two lines that you just added, make it so that the second columns align, regardless of how many letters are in the responses. An ID badge, such as a drivers license or student ID, contains personal details that are formatted in a very specific way. This program will create a properly formatted ID badge.
Clever Stories (story.py) Implement a program that asks the user for a series of words and then displays the story with user's words inserted into the appropriate places. The program should begin by asking the user for each of the words. It should then, fill those words into the appropriate places in the story. Mad Libs are a type of funny story, where a person is asked for words without knowing their context. The words are then placed into a story in a pre-determined format, often resulting in funny statements.
Numeric Variables (numeric.py) Write a program that does the following:
  1. Prompt the user for their age. Convert it to a number, add one to it, and tell them how old they will be on their next birthday.
  2. Prompt the user for the number of egg cartons they have. Assume each carton holds 12 eggs, multiply their number by 12, and display the total number of eggs.
  3. Prompt the user for a number of cookies and a number of people. Then, divide the number of cookies by the number of people to determine how many cookies each person gets.
It´s time to work with numbers, including computing mathematical formulas and other types of expressions, or combinations of variables and operations. For many types of programmers, working through calculations and manipulating numeric data is the primary reason they write programs. For example, scientists today use computers to simulate complex interactions that would be too difficult to work out by hand.
Mathematical Expressions (maths.py) Write a program to convert from Fahrenheit to Celsius. Display the result to one decimal place of precision. With this exercise, you will learn how to solve more interesting problems using numeric data types.
Areas of Shapes (areas.py) Write a program to compute the areas of three different shapes. Prompt for the necessary information, then compute and display the area, as follows:
Make sure that your program can appropriately handle decimal values as well as whole numbers.
Square: The area is the length of a side squared.
Rectangle: The area is the length multiplied by the width.
Circle: The area is Pi (you can use 3.14) multiplied by the radius squared.
Instead of using 3.14 for your value of Pi, see if you can find and use the built-in value of Pi included in the python "math" module.
Python can be used to calculate values for data analysis and complex mathematical and scientific problems. With this activity, you will practice using variables and expressions for straight-forward math calculations. The purpose of the assignment is to help you become more comfortable using variables to accomplish a problem, not to focus on the actual math at hand.
Meal Price Calculator (meal.py) Compute the price of a meal as follows by asking for the price of child and adult meals, the number of each, and then the sales tax rate. Use these values to determine the total price of the meal. Then, ask for the payment amount and compute the amount of change to give back to the customer.
Keep in mind that some of these values are floating point numbers (they can have decimals) and some of them are integers (whole numbers).
Programs can obtain information from users and then combine those values to compute meaningful results. This program will calculate the price of a meal.

About

Exercises from the course Programming Building Blocks from Brigham Young University-Idaho (BYU-Pathway Worldwide).

Topics

Resources

Stars

Watchers

Forks

Languages