| |

VerySource

 Forgot password?
 Register
Search
View: 2513|Reply: 4

How to implement such a for statement in python

[Copy link]

3

Threads

13

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-10-19 13:30:02
| Show all posts |Read mode
The for statement in c:
for(x=0,y=0;y<5||x<10;y++,x++)
{
………… There are statements below to change the values ​​of x and y.
}
Reply

Use magic Report

0

Threads

23

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-10-19 18:30:05
| Show all posts
Change to while
Reply

Use magic Report

3

Threads

13

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-10-19 20:15:02
| Show all posts
The function of for in python is weakened? ?


Another difference from C.
Reply

Use magic Report

0

Threads

23

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-10-19 20:45:01
| Show all posts
...It's not that it is weakened, but the meaning is different. Python's for is called foreach in Perl and C#, and there is also a for_each in C++, which is used for iteration. You can say that there is no for in Python.
Reply

Use magic Report

3

Threads

13

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-10-19 21:15:01
| Show all posts
No for statement! Yes, thank youthiefgroupfor always replying to my questions! ~! ~
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list