Nous avons 70 invités et aucun membre en ligne

- Chap 2 : Le regime triphasé
- Chap 6 : Champ magnétique tournant
- Chap 1 : Le regime monophasé
- Gestion des projets en sti2d
- Chap 11 : Le régime sinusoïdal

## Cahiers de texte

Calendrier prévisionnel des projets

STI2D SIN en 2018

Consignes pour les projets STI2D SIN

Suivi des projets : Dotproject

Mon handicap ne se voit pas

## Practice Exercises for Variables and Assignments

Solve each of the practice exercises below. Each problem includes three CodeSkulptor links: one for a template that you should use as a starting point for your solution, one to our solution to the exercise, and one to a tool that automatically checks your solution.

- Given a template that pre-defines a variable miles, write an assignment statement that defines a variable feetwhose value is the number of feet in miles miles. Miles to feet template --- Miles to feet solution --- Miles to feet (Checker)
- Given a template that pre-defines three variables hours, minutes and seconds, write an assignment statement that updates the variable total_seconds to have a value corresponding to the total number of seconds for hours hours, minutes minutes and seconds seconds. Hours to second template --- Hours to second solution ---Hours to second (Checker)
- Given a template that pre-defines the variables width and height that are the lengths of the sides of a rectangle, write an assignment statement that defines a variable perimeter whose value is the perimeter of the rectangle in inches. Perimeter of rectangle template --- Perimeter of rectangle solution --- Perimeter of rectangle (Checker)
- Given a template that pre-defines the variables width and height that are the lengths of the sides of a rectangle, write an assignment statement that defines a variable area whose value is the area of the rectangle in square inches. Area of rectangle template --- Area of rectangle solution --- Area of rectangle (Checker)
- Given a template that pre-defines the constant PI and the variable radius corresponding to the radius of a circle in inches, write an assignment statement that defines a variable circumference whose value is the circumference of a circle with radius radius in inches. Circumference of circle template --- Circumference of circle solution --- Circumference of circle (Checker)
- Given a template that pre-defines the constant PI and the variable radius corresponding to the radius of a circle in inches, write an assignment statement that defines a variable area whose value is the area of a circle with radius radius in square inches.Area of circle template --- Area of circle solution --- Area of circle (Checker)
- Given the pre-defined variables present_value, annual_rate and years, write an assignment statement that define a variable future_value whose value is present_value dollars invested at annual_rate percent interest, compounded annually for years years. Future value template --- Future value solution --- Future value (Checker)
- Give the pre-defined variables first_name and last_name, write an assignment statement that defines the variable name_tag whose value is the string "My name is % %." where the percents should be replaced by first_name and last_name. Note that, in Python, you can use the + operator on strings to concatenate (i.e. join) them together into a single string. Name tag template --- Name tag solution --- Name tag (Checker)
- Given the pre-defined variables name (a string) and age (a number), write an assignment statement that defines a variable statement whose value is the string "% is % years old." where the percents should be replaced by name and the string form of age. Name and age template --- Name and age solution --- Name and age (Checker)
- Given the variables x0, y0, x1, and y1, write an assignment statement that defines a variable distance whose values is the distance between the points (x0,y0) and (x1,y1). Point distance template --- Point distance solution --- Point distance (Checker)
**Challenge:**Heron's formulastates the area of a triangle is s(s−a)(s−b)(s−c)−−−−−−−−−−−−−−−−−√ where a, b and c are the lengths of the sides of the triangle and s=12(a+b+c) is thesemi-perimeterof the triangle. Given the variables x0, y0, x1,y1, x2, and y2, write a Python program that computes a variable area whose value is the area of the triangle with vertices (x0,y0), (x1,y1) and (x2,y2). (Hint: our solution uses five assignment statements.) Triangle area template --- Triangle area solution --- Triangle area (Checker)

- Détails
- Écrit par Richard GAUTHIER
- Affichages : 645

## Practice Exercises for Expressions

Solve each of the practice exercises below. Each problem includes three CodeSkulptor links: one for a template that you should use as a starting point for your solution, one to our solution to the exercise, and one to a tool that automatically checks your solution.

- There are 5280 feet in a mile. Write a Python statement that calculates and prints the number of feet in 13 miles.Miles to feet template --- Miles to feet solution --- Miles to feet (Checker)
- Write a Python statement that calculates and prints the number of seconds in 7 hours, 21 minutes and 37seconds.Hours to seconds template --- Hours to seconds solution --- Hours to seconds (Checker)
- The perimeter of a rectangle is 2w+2h, where w and h are the lengths of its sides. Write a Python statement that calculates and prints the length in inches of the perimeter of a rectangle with sides of length 4 and 7 inches.Perimeter of rectangle template ---Perimeter of rectangle solution --- Perimeter of rectangle (Checker)
- The area of a rectangle is wh, where w and h are the lengths of its sides. Note that the multiplication operation is not shown explicitly in this formula. This is standard practice in mathematics, but not in programming. Write a Python statement that calculates and prints the area in square inches of a rectangle with sides of length 4 and 7 inches.Area of rectangle template Area of rectangle solution Area of rectangle (Checker)
- The circumference of a circle is 2πr where r is the radius of the circle. Write a Python statement that calculates and prints the circumference in inches of a circle whose radius is 8 inches. Assume that the constant π=3.14.Circumference of circle template --- Circumference of circle solution --- Circumference of circle (Checker)
- The area of a circle is πr2 where r is the radius of the circle. (The raised 2 in the formula is an exponent.) Write a Python statement that calculates and prints the area in square inches of a circle whose radius is 8 inches. Assume that the constant π=3.14. Area of circle template --- Area of circle solution --- Area of circle (Checker)
- Given p dollars, the future value of this money when compounded yearly at a rate of r percent interest for y years is p(1+0.01r)y. Write a Python statement that calculates and prints the value of 1000 dollars compounded at 7percent interest for 10 years. Future value template --- Future value solution --- Future value (Checker)
- Write a single Python statement that combines the three strings "My name is", "Joe" and "Warren" (plus a couple of other small strings) into one larger string "My name is Joe Warren." and prints the result. Name tag template --- Name tag solution --- Name tag (Checker)
- Write a Python expression that combines the string "Joe Warren is 52 years old." from the string "Joe Warren" and the number 52 and then prints the result (Hint: Use the function str to convert the number into a string.) Name and age template --- Name and age solution --- Name and age (Checker)
- The distance between two points (x0,y0) and (x1,y1) is (x0−x1)2+(y0−y1)2−−−−−−−−−−−−−−−−−−√. Write a Python statement that calculates and prints the distance between the points (2,2) and (5,6). Point distance template --- Point distance solution --- Point distance (Checker)

- Détails
- Écrit par Richard GAUTHIER
- Affichages : 664