0% found this document useful (0 votes)
23 views2 pages

HW#1

The document describes a homework assignment asking students to write programs that compare integers, iterate through a string of numbers to sum them, and count occurrences of a word in a string using basic Python concepts like input, conditionals, and loops without importing additional modules. Students are instructed to include collaborators, save their code as a .py file with a specific naming convention, and upload it to the school's system.

Uploaded by

810003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

HW#1

The document describes a homework assignment asking students to write programs that compare integers, iterate through a string of numbers to sum them, and count occurrences of a word in a string using basic Python concepts like input, conditionals, and loops without importing additional modules. Students are instructed to include collaborators, save their code as a .py file with a specific naming convention, and upload it to the school's system.

Uploaded by

810003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

111A Introduction to Computer and Computer Science

Homework Assignment #1
Due: 10/3 00:00:00
In this homework assignment, you will practice the basic concepts of input, branching,
conditional, and iterations. As you have learned all the related knowledge during the
lectures (if, while, and for).

Problem #1: Comparison

Please use “input” function that asks users to type in three integers {𝑥, 𝑦, 𝑧} and print
the largest odd number among them. If none of them are odd, print “no odd number”.

Problem #2: Iteration

Let 𝑠 be a string that contains a sequence of decimal numbers separated by commas,


e.g., 𝑠 = "4.99,3.2,5.487,0.18". Please write a program that prints the sum of numbers
in string 𝑠.

(Bonus) Problem #3:

Let 𝑠1 be a string that contains words and random characters. Let 𝑠2 be a string that
is a word, e.g., 𝑠1 = "fapplejdsjapplefdn", 𝑠2 = "apple". Please write a program that
prints how many times of 𝑠2 repeats in 𝑠1 .

You are NOT allowed to import any additional module in this home work!!!
Hand in procedure:

As we had mentioned in the lecture, you should list all your collaborators in your
programs. Here is the template:

Please save your code as a “.py” file, where the file name should follow this format:

111A_hw#1_ID.py

For example,

111A_hw#1_0180506.py

Please be aware. We are not going to accept any homework file with wrong file
name or without signature. Please double check the content of your file.

Once you have accomplished your works, you can upload your homework to the
“E3@NYCU” system. There will be a section for uploading your homework.

You might also like