This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in range(0, 6): | |
| print i | |
| j = 0 | |
| while j < 5: | |
| print j | |
| j += 1 | |
| k = 0 | |
| while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main() { | |
| int i = 0, j = 0, k = 0; | |
| // for statement | |
| for (i = 0; i < 5; i++) { | |
| print(i); | |
| } | |
| // while statement | |
| while (j < 5) { | |
| print(j++); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String args[]) { | |
| int i = 0, j = 0, k = 0; | |
| // for statement | |
| for (i = 0; i < 5; i++) { | |
| print(i); | |
| } | |
| // while statement | |
| while (j < 5) { | |
| print(j++); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Traceback (most recent call last): | |
| File "FILENAME", line 12, in <module> | |
| repeat_lyrics() | |
| NameError: name 'repeat_lyrics' is not defined | |
| Process finished with exit code 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def print_lyrics(): | |
| print "I'm a lumberjack, and I'm okay" | |
| print "I sleep all night and I work all day" | |
| # repeat_lyrics() | |
| # return an error: "NameError: name 'repeat_lyrics' is not defined" | |
| def repeat_lyrics(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| void swap(int *n1, int *n2); | |
| void swap(char *n1, char *n2); | |
| void swap(double *n1, double *n2); | |
| int main() { | |
| int num1 = 20, num2 = 30; | |
| swap(&num1, &num2); | |
| std::cout << num1 << ' ' << num2 << std::endl; |
NewerOlder