简单的python代码编程图形,怎么用python编写平行四边形

1,怎么用python编写平行四边形import turtle__Pen = turtle.Pen()__Pen.speed(100)__Pen.forward(100)__Pen.right(80)__Pen.forward(100)__Pen.right(100)__Pen.forward(100)__Pen.right(80)__Pen.forward(100)__Pen.right(100)
2 , 怎么用python写一个123n的程序for i in xrange(0,21): for j in xrange(0,51): if i*5+j*2<=100: print i, j, 100-i*5-j*2#include#include main(){ int n,i,j=0,s=0; scanf("%d",&n); for(i=1;i<=n;i++) { j=j+i; s=s+j; } printf("%d",s); getch(); }
3,python怎么编写斐波那#python写斐波抄那袭有N种写法2113,这是5261其4102中之一1653def fib(n):if n == 1:return [1]if n == 2:return [1, 1]res = [1, 1]for i in range(2, n):res.append(res[-1] + res[-2])return res虽然我很聪明,但这么说真的难到我了【简单的python代码编程图形,怎么用python编写平行四边形】
4 , 用循环语句编写用下列图形#include<stdio.h>int main() int i;for(i=0;i<25;i++)printf("* ");}用C++编写:#include<iostream>using namespace std;int main() int i; for(i=0;i<25;i++)cout<<"*"; cout<<endl;return 0;}C++:for(int i=0;i<25;i++)cout<<"* ";批处理:@echo offtitle 生成*for /L %%i in (1,1,25) do >>temp1.txt set/p="* " <nultype temp1.txtdel temp1.txtecho.pause & exit #include "stdio.h"int main() int i, j, n; n = 4; for (i = 1; i <= n; i++)for (j = 0; j < n - i; j++)printf(" ");for (j = 1; j <= 2 * i - 1; j++)printf("*");printf("\n");} for (i = n - 1; i >= 1; i--)for (j = 0; j < n - i; j++)printf(" ");for (j = 1; j <= 2 * i - 1; j++)printf("*");printf("\n");}}5 , 编程输出下列图案#include<stdio.h>void main() int i,j,k,x,n; n = 4; for(i=1;i<=n;i++) for(j=0;j<n-i;j++) printf(" "); } for(k=0;k<2*i-1;k++) printf("*"); } printf("\n"); } for(i=n-1;i>0;i--) for(j=0;j<n-i;j++) printf(" "); } for(k=0;k<2*i-1;k++) printf("*"); } printf("\n"); } }----欢迎来到------c++部落------------Hello Word!--------无论你是初学者还是专家,只要你热爱编程、交流、分享,c++部落因为你而精彩~C#:参考using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1class Programstatic void Main(string[] args) //打印上半个三角形 for (int line = 1; line <= 4; ++line) //打印行前空格 for (int blank = 1; blank <= 10 - line; ++blank) Console.Write(" "); } //打印星星 for (int star = 1; star <= 2 * line - 1; star++) Console.Write("*"); } //换行 Console.WriteLine(); } //打印下半个 for (int line = 1; line <= 3; line++) //打印空格 for (int blank = 1; blank <= 6 + line; blank++) Console.Write(" "); } //打印星星 for (int star = 1; star <= 5 - (line - 1) * 2; star++) Console.Write("*"); } //换行 Console.WriteLine(); } }}}#include<stdio.h>main()printf("***");printf("*****");printf(" *******");printf("*****");printf("***");printf(" *");}

    推荐阅读