LAB#1
LAB#1
Aim: Understanding basic input/output operations; the use of variables and arithmetic
operators.
1. Create a Python project in which you have the following file: myFirstLabScript.py. This
file will be your first Python script (also called a Python program or Python source code)
that asks the user’s name, and then greets the user. After that, the program will ask the user
to enter his/her student id. Lastly, it will print the id also.
2. Define two variables var1 and var2 and prompt the user to enter their values. Then,
define three variables sum, diff, and prod, and assign to them the summation, difference
and multiplication results of var1 and var2, respectively. Finally, display on the screen the
values of var1, var2, sum, diff, and prod.
3. Assume that you are going to calculate a student’s last score for a course. You will take the
name of the student first. Then, his/her lab grade (%25), midterm grade (%35) and lastly
final grade (%40). Please store each value in a different variable. Calculate the last score of
the student according to the given percentages and print it on the screen with his/her name.
Your last output should be like this:
4. Try to output the below asterisk pattern using the built-in function “print” only once.
*
**
***
**
*
5. Do the previous tasks again, but this time in C++ programming language. For
variables, remember to specify their types. Python usually handles that for you, but C++
does not.