Say "Hello, World!" With Python

Here is a sample line of code that can be executed in Python: print("Hello, World!") You can just as easily store a string as a variable and then print it to stdout: my_string = "Hel

View Solution →

Python If-Else

Task: Given an integer, n , perform the following conditional actions: If n is odd, print Weird If n is even and in the inclusive range of 2 to 5 , print Not Weird If n is even and in th

View Solution →

Arithmetic Operators

The provided code stub reads two integers from STDIN, a and b. Add code to print three lines where: 1.The first line contains the sum of the two numbers. 2.The second line contains the differen

View Solution →

Python: Division

The provided code stub reads two integers, a and b, from STDIN. Add logic to print two lines. The first line should contain the result of integer division, a//b . The second line should contain th

View Solution →

Loops

Task: The provided code stub reads and integer, n , from STDIN. For all non-negative integers i<n, print i^2. Example: n=3 The list of non-negative integers that are less th

View Solution →

Write a function

An extra day is added to the calendar almost every four years as February 29, and the day is called a leap day. It corrects the calendar for the fact that our planet takes approximately 365.25 days to

View Solution →

Print Function

The included code stub will read an integer, n, from STDIN. Without using any string methods, try to print the following: 123...n Note that "" represents the consecutive values i

View Solution →