Write a program that asks the user for two integers that will correspond to the numbering of the first and last lines, then a third integer that will correspond to the number of z before "zigzag" (not counting the first "z" of zigzag), then finally that displays a zig-zag following the following pattern:
Python
Write a program that asks the user for two integers that will correspond to the numbering of the first and last lines, then a third integer that will correspond to the number of z before "zigzag" (not counting the first "z" of zigzag), then finally that displays a zig-zag following the following pattern:
Exemple 1:
Start Number: * user type 3 *
End number: * user type 10 *
Number of z: * user type 5 *
zzzzzzigzag 3
4 zzzzzzigzag
zzzzzzigzag 5
6 zzzzzzigzag
zzzzzzigzag 7
8 zzzzzzigzag
zzzzzzigzag 9
10 zzzzzzigzag
(Even integers must be left-zigzag and odd integers must be right.)
Example 2:
Start number:* user type -2 *
End Number:* user type 4 *
Number of z: * user type 3 *
-2 zzzzigzag
zzzzigzag -1
0 zzzzigzag
zzzzigzag 1
2 zzzzigzag
zzzzigzag 3
4 zzzzigzag
Example 3:
Start Number:* user type 5 *
End number:* user type 0 *
Number of z: * user type 10 *
(Nothing is displayed because 5>0)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images