IT1110E IntroductionTo Programming Ver5.0
IT1110E IntroductionTo Programming Ver5.0
IT1110E IntroductionTo Programming Ver5.0
TABLE OF CONTENT
1. INTRODUCTION ................................................................................................. 2
1.1. PURPOSE AND SCOPE OF THE DOCUMENT ................................................................ 2
1.2. INTENTION OF PRACTICE ......................................................................................... 2
1.3. OTHER INFORMATION ............................................................................................. 3
2. REGULATIONS.................................................................................................... 3
2.1. GENERAL REGULATIONS .......................................................................................... 3
2.2. ASSESSMENT............................................................................................................ 4
2.3. PRACTICE SCHEDULE ............................................................................................... 5
1. INTRODUCTION
1.1. PURPOSE AND SCOPE OF THE DOCUMENT
This document has prepared by the SoICT for DS-AI students learning to
practice IT1110E module – Introduction to Programming with Python. This
document and other supporting materials (will be provided during practice time
based on the actual requirements or changing in content) are provided freely to
students in electronic format ( soft-copy) via online teaching channel (Microsoft
Teams) or via email system of HUST.
2. REGULATIONS
2.1. GENERAL REGULATIONS
When studying online, students take part in a practice session by logging
into the MS Teams online teaching system. Students must be responsible for
managing their accounts and using them for the purpose of studying. Lending
account to others is strictly prohibited.
When participating in the online practice session, students follow the rules
of the classroom, practice under the guidance of lecturers and teaching assistants
(TA). Log in to the practice class on time. Before each practice session, students
should carefully read the provided materials. Students have to read carefully all
instructions for each exercise and listen to the lecturer giving key points to practice.
Students are encouraged to actively ask questions and increase interaction
in the online classroom environment even after the practical session. Students can
leave questions related to practical knowledge and wait for the teacher or teaching
assistant to answer. Students should also actively participate in Q&A topics on the
Computer Center or Applied Algorithms Facebook Groups to stay up to date with
the latest information related to the practice activities.
2.2. ASSESSMENT
a) IT1110E :
1 5 5 500
2 5 4 500
3 5 4 500
4 5 4 500
5 5 3 500
Total 25 20 2500
For example: Student Nguyen Van An after 05 practice sessions completes a total
of 21 sub-exercises and a total score of 1700 points (the students do not reach the
maximum score). So after converting, 1700/2500 = 0.68 = 6.8 points for practice
exercises submitted on the Codeforces system.
1. Click
here to
enter chat
function
Share Spyder
window Share button
Step 3: Students send control of the shared screen or window to the teacher
or TA by pressing the Give Control button and selecting the name of the teacher /
TA to ask for permission
Give control to
lecturer or TA
Step 4: When using, click on the Windcribe button on the right of the
browser address box as shown below and log in to use. Each account has a free
volume of 10Gb/month (recommended to use only for submitting programs to
avoid insufficient traffic). If the student do not have an account, press the SIGN UP
button
Step 5: (If the student does not have an account): After clicking the SIGN UP
button (or go to the following link: https://windscribe.com/signup?ws_ext),
students fill out the information and click the Create Account button, then they
can use this account to log in to use.
Note: If you do not fill in the email when registering, the monthly volume is only 2Gb
Click here
to Register
1010201010TrungLQ
(Write immediately without spaces, note capital letters)
Note:
- Because there is a confirmation step via email, and at the request of HUST, students
must use the HUST e-mail for studying activities.
- If your username is not valid, it will not be approved into the IT1110E subject
practice evaluation system.
Step 4: Check your registered email to receive notifications and follow the
instructions below to confirm your account registration.
Step 2: Submit the request to join and wait for approval. Note: students must
name in the correct format to be approved. Students select the membership type as
"Participant" and then click on Join.
Step 3: Students will wait for approval. After the Admin receives a Join
request to the CodeForces system, if the Handle is valid, the Admin will accept the
request and the student will be a member of the Group of “ĐH Bách Khoa Hà Nội
–– Tin Học Đại Cương”
Step 4: If you are in the right group, students Click on the ĐH Bách Khoa Hà
Nội –– Tin Học Đại Cương in the Group name column (Picture in step 3) and you
will see the Practice lessons for IT1110E module in CONTESTS (Figure below).
IT1110E-Introduction to Programming-20192 (rectangled in red). Students
attending IT1110E module do not need to care about the other practical exercises.
Step 2: Enter GROUPS and move to Group of ĐH Bách Khoa Hà Nội – Tin
học Đại Cương
After Clicking Register as shown in the image above, there will be a notice as
shown below, students Click the Register button (below) to complete the
registration.
When the registration is successful, students will see the status red Register turns
green Registration completed as follows:
From here, students start on IT1110E Practice Exercise and proceed with
submission.
Step 5: After clicking on the P1.1 (Demo), it will lead to the problem description
Step 6: In order to submit code to the system, Students click tab of SUBMIT CODE,
then input code into Source code.
3.7. EXERCISES
P1.1:
Write a program to ask users to enter 2 floating numbers: a and b. Print sum of a
and b.
Type the following code in CodeForces:
Note: Always check input and output format before write a program. The input and
output must have the below format. For example:
Input Output
Float number a
Sum of a and b
Float number b
P1.2:
Write a program that asks the user to type the width and the length of a rectangle
and then outputs to the screen the area and the perimeter of that rectangle.
Note: Always check input and output format before write a program. The input and
output must have the below format.
Input Output
P1.3:
Write a program that asks the user to type 5 integers and writes the average of the
5 integers. This program can use only 2 variables.
Input Output
Integer 1st
Integer 2nd
Integer 3rd Average of the 5 integers
Integer 4th
Integer 5th
P1.4:
Write a program that asks the user to type 2 integers A and B and exchange the
value of A and B. Then, the exchanged values will plus with 1. Print the final results.
Input Output
P1.5:
Write a program that asks the user to type the price without tax of one kilogram of
tomatoes, the number of kilograms you want to buy and the tax in percent units.
The program must write the total price including taxes.
Input Output
P2.1:
Read positive numbers and print the average between them when you type a
number smaller than 1. If at the first time, you input a number smaller than 1,
output print ‘0’.
Input Output
P2.2:
Input Output
T New T
C or F C or F
P2.3:
Write a program that asks the user to type the value of N and compute N!
Note: In this exercise, you must use loop to solve this problem. Do not use library
math of Python.
Input Output
Integer number N N!
P2.4:
Write a program that asks the user to type the values of x and n and compute the
following expressions: import math to calculate factorial
a)
b) 𝑥2 𝑥3 𝑥𝑛
𝑆 = 1 + 𝑥 + + + ⋯+
2 3 𝑛
c) 𝑥2 𝑥3 𝑥𝑛
𝑆 =1+𝑥+ + + ⋯+
2! 3! 𝑛!
d) 𝑥2 𝑥3 (−1)𝑛 𝑥 𝑛
𝑆 = 1 − 𝑥 + − + ⋯+
2! 3! 𝑛!
Note: In this exercise, you use library math by the following python code:
import math;
For example:
To calculate square root: math.sqrt(x)
To calculate factorial: math.factorial(x)
Input Output
S part a
Float number x S part b
Integer number n S part c
S part d
P2.5:
Write a program that asks the user to type an integer N and that indicates if N is a
prime number or not. ‘1’ is true, ‘0’ is false.
Note:
▪ To have better solution, you should minimize a number of loop in use as
possible.
▪ Do not use libraries.
P 3.1:
Write a Python function that takes a positive integer n as an argument and returns
the largest power of 2 less than or equal to n.
Input Output
P 3.2:
Write function prime that indicates an integer N is a prime number or not (return
1 if N is prime and 0 otherwise)
Check if a prime number can be expressed as sum of two prime numbers. If yes,
print ‘1’. If no, print ‘0’. Print the two prime numbers
Input Output
0 or 1
Integer N Prime number 1st
Prime number 2nd
P3.3:
Input Output
Integer 1st
Integer 2nd
Integer 3rd Sum of f(1st)+f(2nd)+…+f(mth)
….
Integer mth
Note: Using library math of python to calculate sine, cosine, and logarithm.
P3.4:
Input Output
H(x,y)
H(-2,5)
Float number x H(-1.5,4)
Float number y H(-1,3)
….
H(6,11)
P3.5:
Input Output
a
b
“No roots” or roots of function
c
Note:
▪ Solve equation in both cases: a = 0 and has complex roots.
▪ If there are not roots, print out a string: “no roots”.
▪ If it has roots, print out those roots.
Write a program that takes two strings r, s. Print out “1” if the second string s
contained within the first. Otherwise, print out ‘0’.
Input Output
String r
1 or 0
String s
P4.2:
Input Output
Note: You should use some python methods with string like join() or spilt().
P4.3:
Write a program which asks you to enter a string and an integer number N. The
program shortens your string to N characters. If the string is already shorter than
N, the program should not change the string. Print out the string.
Input Output
A given string s
Required String
An integer number N
P4.4:
Write a program which asks you to enter two strings s and t, an integer number n.
The program prints the position of the first occurrence of t within a substring of s.
n is the position where the substring begins. If t is not found in the substring of s,
the program prints 0
Input Output
String s
Position of the first occurrence of t
String t
within a substring of s or 0
Integer number n
P4.5:
Write a program that takes two strings. Print out the number of times that each
character appears in both of them and the characters found?
Input Output
Input Output
P5.2:
Write a Python program to enter input elements of list from the keyboard
and find Cumulative sum of a list. Print out the results.
For example: [10, 20, 30, 40, 50] -> [10, 30, 60, 100, 150]
[2, 5, 8, 12] -> [2, 7, 15, 27].
Input Output
P5.3:
Write a Python program to find the greatest common divisor (gcd) of two integers.
Note: Must use recursion.
Input Output
Integer a
The greatest common divisor
Integer b
P5.4:
Write a Python program to enter input elements of list from the keyboard,
find the most frequent element in it. If there are multiple elements that appear
maximum number of times, print any one of them.
Input Output
Element 1st
Element 2nd
Maximum frequency
Element 3rd
Element has the maximum frequency
…
Element nth
P5.5:
Write a Python program to count the occurrences of an integer K in an sorted list.
Enter integer numbers in sorted order in list. Enter integer K. Print out the
occurrences of K.
Input Output